Class vdView
- Namespace
- VectorDraw.Professional.vdPrimaries
- Assembly
- VectorDraw.Professional.dll
Represents a named camera or rendering configuration used to display a document's contents. Encapsulates view parameters (center, size, lens/focal parameters), rendering options (render mode, perspective mode), the world-to-view transformation and per-view frozen-layer behavior.
public class vdView : vdPrimary, IDisposable, IVDSerialise, IBaseObject
- Inheritance
-
vdView
- Implements
- Inherited Members
Examples
Example creating views with named UCS and testing them with a cube with different colors on each face and text aligned to the center of each view.
//create a cube with 6 different colors for each side to test the Views and named UCS
var vertexlist = new gPoints(new gPoint[]
{
//bottom face points
new gPoint(0,0,0),
new gPoint(1,0,0),
new gPoint(1,1,0),
new gPoint(0,1,0),
//top face points
new gPoint(0,0,1),
new gPoint(1,0,1),
new gPoint(1,1,1),
new gPoint(0,1,1),
});
var facelist = new Int32Array(new int[]
{
//bottom face with palette color 0(red)
1,2,3,4,0,
//top face with palette color 1(yellow)
5,6,7,8,1,
//front face with palette color 2(green)
1,2,6,5,2,
//back face with palette color 3(cyan)
4,3,7,8,3,
//left face with palette color 4(blue)
1,4,8,5,4,
//right face with palette color 5(magenta)
2,3,7,6,5,
});
var polyface = new vdPolyface(doc, vertexlist, facelist);
doc.Model.Entities.AddItem(polyface);
//create bootm view with named UCS that is looking from bottom to top and the up direction is the world Y axis
var view = doc.Views.Add("bottom");
view.ViewRenderMode = vdRender.Mode.Shade;
view.ViewSize = 3;
var m = new Matrix();
m.SetFrom(new gPoint(0, 1, 0),new Vector(1,0,0),new Vector(0,-1,0));
view.ViewWorldToViewMatrix = m;
view.ViewNamedUCS = new vdNamedUCS() { UCSMatrix = m };
//create top view with named UCS that is looking from top to bottom and the up direction is the world Y axis
view = doc.Views.Add("top");
view.ViewRenderMode = vdRender.Mode.Shade;
view.ViewSize = 3;
m = new Matrix();
m.SetFrom(new gPoint(0, 0, 1), new Vector(1, 0, 0), new Vector(0, 1, 0));
view.ViewWorldToViewMatrix = m;
view.ViewNamedUCS = new vdNamedUCS() { UCSMatrix = m };
//create front view with named UCS that is looking from front to back and the up direction is the world Z axis
view = doc.Views.Add("front");
view.ViewRenderMode = vdRender.Mode.Shade;
view.ViewSize = 3;
m = new Matrix();
m.SetFrom(new gPoint(0, 0, 0), new Vector(1, 0, 0), new Vector(0, 0, 1));
view.ViewWorldToViewMatrix = m;
view.ViewNamedUCS = new vdNamedUCS() { UCSMatrix = m };
//create back view with named UCS that is looking from back to front and the up direction is the world Z axis
view = doc.Views.Add("back");
view.ViewRenderMode = vdRender.Mode.Shade;
view.ViewSize = 3;
m = new Matrix();
m.SetFrom(new gPoint(1, 1, 0), new Vector(-1, 0, 0), new Vector(0, 0, 1));
view.ViewWorldToViewMatrix = m;
view.ViewNamedUCS = new vdNamedUCS() { UCSMatrix = m };
//create left view with named UCS that is looking from left to right and the up direction is the world Z axis
view = doc.Views.Add("left");
view.ViewRenderMode = vdRender.Mode.Shade;
view.ViewSize = 3;
m = new Matrix();
m.SetFrom(new gPoint(0, 1, 0), new Vector(0, -1, 0), new Vector(0, 0, 1));
view.ViewWorldToViewMatrix = m;
view.ViewNamedUCS = new vdNamedUCS() { UCSMatrix = m };
//create right view with named UCS that is looking from right to left and the up direction is the world Z axis
view = doc.Views.Add("right");
view.ViewRenderMode = vdRender.Mode.Shade;
view.ViewSize = 3;
m = new Matrix();
m.SetFrom(new gPoint(1, 0, 0), new Vector(0, 1, 0), new Vector(0, 0, 1));
view.ViewWorldToViewMatrix = m;
view.ViewNamedUCS = new vdNamedUCS() { UCSMatrix = m };
//test the named UCS and views by adding text in each view that is aligned to the center of the view and with the same height in all views
doc.ActiveTextStyle.Height = 0.2;
doc.ActiveTextHorJustify = VdConstHorJust.VdTextHorCenter;
doc.ActiveTextVerJustify = VdConstVerJust.VdTextVerCen;
//change the active view to each view and add text with the name of the view in the center of the view
//using the CmdText to add the text in order to test also the correct working of the input point in different views and named UCS
for (int i = 0; i <doc.Views.Count; i++)
{
view = doc.Views[i];
doc.ActiveView = view;
//changing the active view will also set tha view's ucs as the active UCS so the point and vector
//are relative to the view and its named UCS
//for all the commands in vdDocument.CommandAction methods
doc.CommandAction.CmdText(view.Name, new gPoint(0.5, 0.5, 0.1), 0.0);
}
doc.Redraw(false);
Remarks
A vdView instance describes how a document is visualized. Views are typically
registered in a parent vdDocument via the document's vdViews collection.
Use SetFromLayout(vdLayout) or SetFromViewPort(vdViewport) to copy settings
from an existing layout or viewport. The view's frozen-layer behavior is controlled by
IgnoreFrozenLayers and FrozenLayerList
see ActiveView of vdDocument to get or set the active view of a document.
Views of vdDocument to get the collection of views of a document.
Constructors
- vdView()
Initializes the vdView object.
- vdView(string)
Initializes the vdView object with the passed name.
- vdView(vdViewport, string)
Initializes the vdView object with the passed viewport object.
- vdView(vdDocument)
Initializes the vdView object with the passed Document.
- vdView(vdDocument, string)
Initializes the vdView object with the passed Document.
- vdView(vdLayout, string)
Initializes the vdView object with the passed layout object.
Properties
- AspectRatioX
Get/Set the aspect ratio that determines the field of view in the x-direction.
- Description
Get/Set a Description string for the object
- FrozenLayerList
Get/Set a string array contaning the names of the layers to be frozen in the view.
- IgnoreFrozenLayers
Get/Set a boolean value that Ignores or not the default frozen property of document layers.
- Name
Get/Set the name of the vdView object
- ViewCenter
Get/Set the view center of the view.
- ViewFocalLength
Get/Set the Focal Length for the View.
- ViewLayout
Get/Set the Layout object of the View.
- ViewLensAngle
Get/Set the Lens Angle of the View in degrees.
- ViewNamedUCS
Get/Set the named UCS for the view.
- ViewPerspectiveMod
Get/Set the PerspectiveMod of the view.
- ViewRenderMode
Get/Set the render mode for the view.
- ViewSize
Get/Set the Viewsize of the view.
- ViewWorldToViewMatrix
Get/Set a Matrix that represents the WorldToView matrix of the view.
- VisibleOnForms
Get/Set a boolean value representing if the vdView will be viewed in Vectordraw forms.
Methods
- DeSerialize(DeSerializer, string, object)
This Function is called foreach field name of the vdView object when opening in vdml format.
- Serialize(Serializer)
This Function is called when saving the vdNamedUCS object to vdml format.
- SetFrom(IvdRenderingView)
Sets the properties of the vdView object with the passed VectorDraw.Professional.vdPrimaries.IvdRenderingView properties.
- SetFromLayout(vdLayout)
Sets the properties of the vdView object with the passed layout's properties.
- SetFromViewPort(vdViewport)
Sets the properties of the vdView object with the passed viewport's properties.
- ToString()
Gets a System.String that represents the name of the vdView Object.
- ZoomWindow(gPoint, gPoint)
Change the ViewCenter and ViewSize in order the passed window best fit in curent selected drawing area.