RhinoViewport
Displays geometry with a given projection. In standard modeling views there is a one to one relationship between RhinoView and RhinoViewports. In a page layout, there may be multiple RhinoViewports for a single layout.
Inheritance Hierarchy
System.Object
Rhino.Display.RhinoViewport
Namespace: Rhino.Display
Assembly: RhinoCommon (in RhinoCommon.dll)
Syntax
public class RhinoViewport : IDisposable
The RhinoViewport type exposes the following members.
Constructors
Name
Description
Public Method
RhinoViewport.
Initializes a new instance of the RhinoViewport class
Public Method
RhinoViewport(RhinoViewport)
Initializes a new instance of the RhinoViewport class
Properties
Name
Description
Public Property
Bounds
Gets the size and location of the viewport, in pixels, relative to the parent view.
Public Property
Camera35mmLensLength
Public Property
CameraDirection
Public Property
CameraLocation
Public Property
CameraTarget
Viewport target point.
Public Property
Code Example
CameraUp
Public Property
CameraX
Gets the “unit to the right” vector.
Public Property
CameraY
Gets the “unit up” vector.
Public Property
CameraZ
Gets the unit vector in CameraDirection.
Public Property
ChangeCounter
The value of change counter is incremented every time the view projection or construction plane changes. The user can the mouse and nestable view manipulation commands to change a view at any time. The value of change counter can be used to detect these changes in code that is sensitive to the view projection.
Public Property
ConstructionAxesVisible
Public Property
ConstructionGridVisible
Public Property
DisplayMode
Public Property
FrustumAspect
Gets the width/height ratio of the frustum.
Public Property
Id
Unique id for this viewport.
Public Property
IsParallelProjection
Public Property
IsPerspectiveProjection
Public Property
IsPlanView
true if construction plane z axis is parallel to camera direction.
Public Property
IsTwoPointPerspectiveProjection
Public Property
IsValidCamera
Public Property
IsValidFrustum
Public Property
LockedProjection
If true, the the camera location, camera direction, and lens angle should not be changed.
Public Property
Code Example
Name
Name associated with this viewport.
Public Property
ParentView
Gets the parent view, if there is one Every RhinoView has an associated RhinoViewport that does all the 3d display work. Those associated viewports return the RhinoView as their parent view. However, RhinoViewports are used in other image creating contexts that do not have a parent RhinoView. If you call ParentView, you MUST check for NULL return values.
Public Property
ScreenPortAspect
screen port’s width/height.
Public Property
Code Example
Size
Get or set the height and width of the viewport (in pixels)
Public Property
UserStringCount
Public Property
ViewportType
Public Property
WallpaperFilename
Public Property
WallpaperGrayscale
Public Property
WallpaperVisible
Public Property
WorldAxesVisible
Methods
Name
Description
Public Method
ChangeToParallelProjection
Use this function to change projections of valid viewports from perspective to parallel. It will make common additional adjustments to the frustum so the resulting views are similar. The camera location and direction will not be changed.
Public Method
ChangeToPerspectiveProjection(Boolean, Double)
Use this function to change projections of valid viewports from parallel to perspective. It will make common additional adjustments to the frustum and camera location so the resulting views are similar. The camera direction and target point are not be changed.
Public Method
ChangeToPerspectiveProjection(Double, Boolean, Double)
Use this function to change projections of valid viewports from parallel to perspective. It will make common additional adjustments to the frustum and camera location so the resulting views are similar. The camera direction and target point are not be changed.
Public Method
ChangeToTwoPointPerspectiveProjection(Double)
Use this function to change projections of valid viewports to a two point perspective. It will make common additional adjustments to the frustum and camera location and direction so the resulting views are similar.
Public Method
ChangeToTwoPointPerspectiveProjection(Double, Vector3d, Double)
Use this function to change projections of valid viewports to a two point perspective. It will make common additional adjustments to the frustum and camera location and direction so the resulting views are similar.
Public Method
ClearTraceImage
Remove trace image (background bitmap) for this viewport if one exists.
Public Method
ClientToScreen(Point)
Public Method
ClientToScreen(Point2d)
Public Method
ClientToWorld(Point)
Public Method
ClientToWorld(Point2d)
Public Method
Code Example
ConstructionPlane
Simple plane information for this viewport’s construction plane. If you want detailed construction plane information, use GetConstructionPlane.
Public Method
DeleteAllUserStrings
Public Method
DeleteUserString
Public Method
Dispose.
Releases all resources used by the RhinoViewport
Protected Method
Dispose(Boolean)
Releases the unmanaged resources used by the RhinoViewport and optionally releases the managed resources
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected Method
Finalize
(Overrides Object.Finalize..)
Public Method
Static Member
FromId
Call this method to get the viewport with the specified Id.
Public Method
GetCameraAngle
Public Method
GetCameraExtents
Public Method
GetCameraFrame
Gets the camera plane.
Public Method
GetConstructionPlane
Public Method
GetDepth(Point3d, Double.)
Gets clipping distance of a point.
Public Method
GetDepth(BoundingBox, Double., Double.)
Gets near and far clipping distances of a bounding box.
Public Method
GetDepth(Sphere, Double., Double.)
Gets near and far clipping distances of a sphere.
Public Method
GetFarRect
Get corners of far clipping plane rectangle.
Public Method
GetFrustum
Gets the view frustum.
Public Method
GetFrustumBottomPlane
Get bottom world frustum clipping plane.
Public Method
GetFrustumBoundingBox
Public Method
GetFrustumCenter
Returns world coordinates of frustum’s center.
Public Method
GetFrustumFarPlane
Get far clipping plane.
Public Method
GetFrustumLeftPlane
Get left world frustum clipping plane.
Public Method
GetFrustumLine
Gets the world coordinate line in the view frustum that projects to a point on the screen.
Public Method
GetFrustumNearPlane
Get near clipping plane.
Public Method
GetFrustumRightPlane
Get right world frustum clipping plane.
Public Method
GetFrustumTopPlane
Get top world frustum clipping plane.
Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public Method
GetNearRect
Get corners of near clipping plane rectangle.
Public Method
GetPickTransform(Point)
Takes a rectangle in screen coordinates and returns a transformation that maps the 3d frustum defined by the rectangle to a -1/+1 clipping coordinate box. This takes a single point and inflates it by Rhino.ApplicationSettings.ModelAidSettings.MousePickBoxRadius to define the screen rectangle.
Public Method
GetPickTransform(Rectangle)
Takes a rectangle in screen coordinates and returns a transformation that maps the 3d frustum defined by the rectangle to a -1/+1 clipping coordinate box.
Public Method
GetPickTransform(Int32, Int32)
Takes a rectangle in screen coordinates and returns a transformation that maps the 3d frustum defined by the rectangle to a -1/+1 clipping coordinate box. This takes a single point and inflates it by Rhino.ApplicationSettings.ModelAidSettings.MousePickBoxRadius to define the screen rectangle.
Public Method
GetScreenPort
Location of viewport in pixels. These are provided so you can set the port you are using and get the appropriate transformations to and from screen space.
Public Method
Code Example
GetTransform
Gets a transform from origin coordinate system to a target coordinate system.
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public Method
GetUserString
Gets a user string.
Public Method
GetUserStrings
Gets an independent copy of the collection of (user text key, user text value) pairs attached to this object.
Public Method
GetViewScale
Get Scale transform applied to the viewport
Public Method
GetWorldToScreenScale
Gets the world to screen size scaling factor at a point in frustum.
Public Method
IsVisible(BoundingBox)
Returns true if some portion of a world coordinate bounding box is potentially visible in the viewing frustum.
Public Method
IsVisible(Point3d)
Determines if a world coordinate point is visible in the viewing frustum.
Public Method
KeyboardDolly
Emulates the keyboard arrow key in terms of interaction.
Public Method
KeyboardDollyInOut
Emulates the keyboard arrow key in terms of interaction.
Public Method
KeyboardRotate
Emulates the keyboard arrow key in terms of interaction.
Public Method
Magnify(Double, Boolean)
Zooms or dollies in order to scale the viewport projection of observed objects.
Public Method
Magnify(Double, Boolean, Point)
Zooms or dollies in order to scale the viewport projection of observed objects.
Protected Method
MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public Method
MouseAdjustLensLength
Adjusts the camera lens length.
Public Method
MouseDollyZoom
Zooms lens (thus adjusting the field of view) while moving the camera.
Public Method
MouseInOutDolly
Moves the camera towards or away from the view maintaining focus on the view.
Public Method
MouseLateralDolly
Pans the camera
Public Method
MouseMagnify
Moves the camera towards or away from the view.
Public Method
MouseRotateAroundTarget
Rotates the viewport around target.
Public Method
MouseRotateCamera
Rotates the view around the camera location.
Public Method
MouseTilt
Tilts the camera view.
Public Method
NextConstructionPlane
Sets the construction plane to the plane that was active before the last call to PreviousConstructionPlane.
Public Method
NextViewProjection
Sets the view projection and target to the settings that were active before the last call to PrevView.
Public Method
PopConstructionPlane
Sets the construction plane to the plane that was active before the last call to PushConstructionPlane.
Public Method
Code Example
PopViewProjection
Sets the view projection and target to the settings at the top of the view stack and removes those settings from the view stack.
Public Method
PreviousConstructionPlane
Sets the construction plane to the plane that was active before the last call to NextConstructionPlane or SetConstructionPlane.
Public Method
PreviousViewProjection
Sets the view projection and target to the settings that were active before the last call to NextViewProjection.
Public Method
PushConstructionPlane
Pushes the current construction plane on the viewport’s construction plane stack and sets the construction plane to cplane.
Public Method
PushViewInfo
Public Method
Code Example
PushViewProjection
Appends the current view projection and target to the viewport’s view stack.
Public Method
Rotate
Rotates about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule).
Public Method
ScreenToClient
Public Method
Code Example
SetCameraDirection
Set viewport camera direction. By default the target location is changed so that the vector from the camera location to the target is parallel to the camera direction.
Public Method
Code Example
SetCameraLocation
Set viewport camera location. By default the target location is changed so that the vector from the camera location to the target is parallel to the camera direction vector.
Public Method
SetCameraLocations
Set viewport camera location and target location. The camera direction vector is changed so that it is parallel to the vector from the camera location to the target location.
Public Method
SetCameraTarget
Set viewport target point. By default the camera location is translated so that the camera direction vector is parallel to the vector from the camera location to the target location.
Public Method
SetClippingPlanes
Sets optimal clipping planes to view objects in a world coordinate 3d bounding box.
Public Method
SetConstructionPlane(ConstructionPlane)
Sets the construction plane to cplane.
Public Method
SetConstructionPlane(Plane)
Public Method
SetProjection
Set viewport to a defined projection.
Public Method
SetToPlanView
Public Method
Code Example
SetTraceImage
Set trace image (background bitmap) for this viewport.
Public Method
SetUserString
Attach a user string (key,value combination) to this geometry.
Public Method
SetViewProjection
Sets the viewport camera projection.
Public Method
SetWallpaper(String, Boolean)
Public Method
SetWallpaper(String, Boolean, Boolean)
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object.)
Public Method
WorldToClient
Convert a point from world coordinates in the viewport to a 2d screen point in the local coordinates of the viewport (X/Y of point is relative to top left corner of viewport on screen)
Public Method
ZoomBoundingBox
Zooms the viewport to the given bounding box.
Public Method
Code Example
ZoomExtents
Dollies the camera location and so that the view frustum contains all of the selected document objects that can be seen in view. If the projection is perspective, the camera angle is not changed.
Public Method
ZoomExtentsSelected
Dollies the camera location and so that the view frustum contains all of the selected document objects that can be seen in view. If the projection is perspective, the camera angle is not changed.
Public Method
ZoomWindow
Zooms the viewport to the given rectangle.