Two Dimensional Views (Pure 2D)
	
	Two Dimensional Mode of DG Kernel components allow displaying items which 
	are two dimensional by its nature, namely sets of lines, points and 2D 
	shapes.
 
	Two Dimensional view (2D 
	View) keeps internally a 2D item set, which is a 2D 
	analogue of 3D model. Although 2D set is often generated from 3D model of the component it can be completely independent. 
	Use IView2.SetViewType to 
	switch between two and three dimensional modes of the component. 2D View functionality is controlled via
	I2DView_KC Interface, 
	which cal be obtained via: DG Kernel >
	GetView >
	IView
	> I2DView_KC 
	2D Views have number of properties (see the table below), 
	which define how the items are displayed. Programmatically these properties 
	can be managed via IKCContext 
	queried from the I2DView_KC. 
	2D Views have also a 3D frame associated with it. 
	The frame is called 
	Frame of 2D View. It is used 
	for mapping between 2D coordinates of the view and 3D coordinates of the 
	main model.  
	x and y plane of the frame is called plane of the view. The frame, hence 
	position and orientation of the plane can be set arbitrary via
	IFrame and other related frame interfaces 
	queried from the IKCContext. 
	
 
	There are two ways to add 2D items to the 2D item set:
	1. 2D Mapping
	With this method 2D items are generated by mapping 3D objects of the main 
	model of the component to 2D coordinate axes and adding the results to the 
	2D scene automatically. Currently there are two methods of mapping:  
	interentity and projection.  
	2D mapping is very useful for displaying planar entitys of objects or projections to a plane It requires minimal programming. 
	Both methods use frame of the view (see above) to define the plane on 
	which the image is generated and orientation of 2D axes inside the plane. 2D 
	x and y axes are x and y axes of the frame of view. 
	With interentity mapping each object of the 3D model is intersected with 
	plane of the view (see above). If interentity is not empty interentity 
	line is mapped to local x and y coordinates of the frame of view and added 
	to 2D scene as a new item. 
	With projection mapping each object of the 3D model is projected to the 
	plane of the view. The result will look as if the 3D point of view 
	has changed so that the viewer is looking along negative direction of z axis 
	of the frame of view and y axis is up.  
	The projection  works on per patch basis. A 3D patch is projected as 
	a polygon (curvilinear in general case) rendered as line loop of its edge. 
	When hidden line removal is enabled (default) lines which are covered by a 
	higher polygon (the 3D edge from which the line was projected is invisible 
	in 3D from end of z axis of the frame of view) are removed. Projected lines are 
	mapped to local x and y coordinates of the frame of view and added to 2D 
	scene as a new item. 
	The above work is performed during
	UpdateSurface
	call. when view type is set to 2D. 
	2D items keep information about its z position along z axis of the frame 
	of view. 
	To use 2D Mapping mode: 
	
		- Set view type to 2D with 
		IView2.SetViewType(EViewType.eViewType2D)
 
	- Query I2DView_KC via: 
	DG Kernel >
	GetView >
	IView
	> I2DView_KC
 
	- Obtain IKCContext 
	via 
	I2DView_KC.GetContext.
 
	- Set required mapping type with IKCContext.SetIntParam(0,
	E2DViewGeometryType.e2DViewGeometryTypeInterentity 
	) or IKCContext.SetIntParam(0, 
	E2DViewGeometryType.e2DViewGeometryTypeProjection 
	)
 
		- Use
	IFrame or/and IFrame2
	queried from the IKCContext. 
		to set position and orientation of the plane of the view and x, y axes 
		inside the plane.
 
		- Call UpdateSurface
		to create the 2D items and display them in the view
 
 
	See Cross 
	View Sample for an example. 
	With Direct Definition method 2D items are defined and added to the scene directly without any reference to any 3D objects. 
	To use Direct Definition mode: 
	
		- Set view type to 2D with 
		IView2.SetViewType(EViewType.eViewType2D)
 
	- Query IKCContext via: 
	DG Kernel >
	GetView >
	IView
	> I2DView_KC > IKCContext
 
	- Query IDraw 
	from IKCContext.
 
		- Use IDraw.Begin,
		IDraw.Vertex,
		IDraw.End to add lines, points or 
		shapes to the 2D item set. Use 
		I2DView_KC.AddText 
		to add text stings at specified locations
 
		- Use 
		I2DView_KC.AddText to add text strings
 
		- Call UpdateView to 
		redraw the window
 
 
Note that IDraw is used here in an unusual way. 
Instead of normal drawing of a single scene it is used to define geometry, which 
will be used in multiple rendering with possible window resizing, etc. 
See MidImplementation.AddProjection() method of
Cross 
	View Sample for an example. 
	  
Both 2D Mapping and Direct Definition methods can be used simultaneously. So 
that 2D view can contain items generated both by 2D mapping and items 
created directly. 
Use I2DView_KC.RemoveAll to remove all items from 
the View. 
Often 2D mode is used to show a model in multiple 
projections. This can be achieved by using External models. 
When ShowAngles property is true the view displays text strings 
with angles in degrees inside narrowest corners of 2D polygons. Angles 0, 90, 
and 180 are not displayed. This functionality is useful mostly when objects have 
straight edges in 3D. Font of the text can be modified by queering
IDIFont
from the return of IKCContext.GetParam(0), See 
ChildrenFont in the table below 
When ShowRulersOrGrid property is true either grid or vertical 
and horizontal rulers showing dimensions of the object(s) are displayed. Font of 
dimensions can be modified by queering IDIFont
from the return of IKCContext.GetParam(1), See 
DimensionsFont in the table below. 
	When rules are on and the 2D items are very long in one direction the 
	scene is displayed with a break in the middle to use space of the window 
	more efficiently.. Use BreakLongDimension property to disable this 
	functionality. 
	When ShowSideAnnotation property is true and frame of the 
	view is aligned with global axes, more exactly orientation of the frame of 
	the view coincides with orientation of the global frame rotated one or more 
	times around its axes by 90 degrees, "Front", "Left", etc text will be 
	displayed at the top left corner of the view. Font of the annotation can be 
	modified by queering IDIFont
	from the return of IKCContext.GetParam(2), See 
	SideAnnotationFont in the table below. 
	2D Views can be printed using
	IPrint_KC
	obtained via: DG Kernel > GetView
	> IView
	> IPrint_KC. 
Properties of 2D View accessed via IKCContext 
	
		| Name | 
		Type | 
		Description | 
		Deafult | 
		Context Parameter ID for  IKCContext | 
	 
	
		| 
GeometryType | 
		Integer | 
		Valid values are enumerated in 
		E2DViewGeometryType. | 
		0 | 
		0 | 
	 
	
		| HorizontalRulerTickDistance | 
		Double | 
		Minimal distance between ticks in horizontal ruler | 
		-1 (calculated dynamically at runtime) | 
		0 | 
	 
	
		| VerticalRulerTickDistance | 
		Double | 
		Minimal distance between ticks in vertical ruler | 
		-1 (calculated dynamically at runtime) | 
		1 | 
	 
	
		| ShowAngles | 
		Boolean | 
		Display angles. See above | 
		true | 
		0 | 
	 
	
		| ShowRulersOrGrid | 
		Boolean | 
		Show either rulers or grid depending on ShowGrid 
		value | 
		true | 
		1 | 
	 
	
		| ShowGrid | 
		Boolean | 
		Show grid, not rulers if ShowRulersOrGrid 
		is true | 
		
false | 
		
2 | 
	 
	
		| ShowSideAnnotation | 
		Boolean | 
		Show annotation of the front side for standard 
		orientation | 
		
false | 
		
3 | 
	 
	
		| SideAnnotationFont | 
		IDIFont | 
		Font for ShowSideAnnotation property | 
		
Arial, size 10, black | 
		
2 | 
	 
	
		| ShowAxesAnnot | 
		Boolean | 
		Show orientation of global axes as icon in bottom left 
		corner | 
		
false | 
		
4 | 
	 
	
		| ChildrenFont  (Angles) | 
		IDIFont | 
		Font to be used for angles. Color modified via ColorDefaultChildren | 
		
Arial, size 10, red | 
		
0 | 
	 
	
		| DimensionsFont | 
		IDIFont | 
		Font to be used for dimensions. Color modified via ColorRulerText | 
		
Arial, size 10, dark blue | 
		
1 | 
	 
	
		| BreakLongDimension | 
		Boolean | 
		Break excessively long dimension.
		UpdateSurface must be 
		called on change | 
		
true | 
		
5 | 
	 
	
		| HorVisibleRange | 
		IRange | 
		range of model's x coordinate visible in the window.
		More... | 
		
Dynamic | 
		
3 | 
	 
	
		| VertVisibleRange | 
		IRange | 
		range of model's y coordinate visible in the window.
		More... | 
		
Dynamic | 
		
4 | 
	 
	
		| EnabledHorPan | 
		Boolean | 
		Enables / disables pan in x direction | 
		
true | 
		
6 | 
	 
	
		| EnabledVertPan | 
		Boolean | 
		Enables / disables pan in y direction | 
		
true | 
		
7 | 
	 
	
		| EnabledZoom | 
		Boolean | 
		Enables / disables zoom | 
		
true | 
		
8 | 
	 
	
		| BreakTrigger | 
		Double | 
		A tune-in parameter for BreakLongDimension. 
		Valid range: [0, 1]. Increasing triggers break for longer models | 
		
0.2 | 
		
3 | 
	 
	
		| LineWidth | 
		Integer | 
		Line width in the drawing in pixels. Valid range : 1 to 
		255 | 
		
1 | 
		
1 | 
	 
	
		| DimensionLineWidth | 
		Integer | 
		Line width of dimensions. Valid range : 1 to 255 | 
		
1 | 
		
2 | 
	 
	
		| TickLineWidth | 
		Integer | 
		Line width ticks in dimensions in pixels. Valid range : 
		1 to 255 | 
		
1 | 
		
3 | 
	 
	
		| LineWidthAll | 
		Integer | 
		When set modifies LineWidth, DimensionLineWidth 
		and TickLineWidth to the new value. When retrieved the 
		returned value is the minimum of the three width values. | 
		
1 | 
		
4 | 
	 
	
		| DimensionTickSizeFactor | 
		Double | 
		Default length of ticks is multiplied by this factor 
		just before rendering | 
		
1.0 | 
		
5 | 
	 
	
		| DimensioLineDistFactor | 
		Double | 
		Default distance dimension line to drawing and distance 
		between two dimension lines is multiplied by this factor just before 
		rendering | 
		
1.0 | 
		
6 | 
	 
	
		| DistDimLineToDimTextHoriz | 
		Integer | 
		Distance of horizontal dimension line to dimension text 
		in pixels. If negative default (1) is used | 
		
-1 (means use default = 1) | 
		
5 | 
	 
	
		| DistDimLineToDimTextVert | 
		Integer | 
		Distance of vertical dimension line to dimension text in 
		pixels. If negative default (5) is used | 
		
-1 (means use default = 5) | 
		
6 | 
	 
	
		| BreakLineWidth | 
		Integer | 
		Width of break line in device units (pixels) | 
		
1 | 
		
7 | 
	 
	
		| BreakLineStyle | 
		Integer | 
		Styles of the break line: 
		SOLID 0 
		DASH 1 /* ------- */ 
		DOT 2 /* ....... */ 
		DASHDOT 3 /* _._._._ */ 
		DASHDOTDOT 4 /* _.._.._ */ | 
		
1 valid range 0 to 4 | 
		
8 | 
	 
	
		| DrawingBounds | 
		
		IRectangleAxisAligned_KC | 
		Axis aligned bounding rectangle of the drawing. 
		Read-only property | 
		
none | 
		
5 | 
	 
	
		| BreakRange | 
		IRange | 
		Minimum and Maximum positions of the break range for 
		long drawings. Empty if break not applied. Read-only property | 
		
Dynamic | 
		
6 | 
	 
	
		| BreakGap | 
		IRange | 
		Minimum and Maximum positions of the break gap for long 
		drawings after break has been applied. Empty if break not applied. 
		Read-only property | 
		
Dynamic | 
		
7 | 
	 
	
		| RemoveTesselation | 
		Boolean | 
		If true any internal polygons on a flat front surface 
		will be removed from the drawing. This operation is performed prior to 
		the DetectCurces stage (see the next property) | 
		
false | 
		
10 | 
	 
	
	    DetectCurves
		| DetectCurves | 
		Boolean | 
		If true the software will detect isolated circles in the 
		drawing and will add special location and radius annotation. | 
		
false | 
		
11 | 
	 
	
		| SetupHorAlignment | 
		Boolean | 
		Has to be set true on the control, which will be aligned 
		to horizontally. See Alignment | 
		
false | 
		
13 | 
	 
	
		| SetupVertAlignment | 
		Boolean | 
		Has to be set true on the control, which will be aligned 
		to vertically. See Alignment | 
		
false | 
		
14 | 
	 
	
		| NewItemLineStyle | 
		Integer | 
		Defines line style for newly added items. See BreakLineStyle 
		property for more details. | 
		
0 valid range 0 to 4 | 
		
9 | 
	 
	
		| RulersAllSides | 
		Boolean | 
		If true dimension lines can appear on all four sides of 
		the drawing to optimize usage of space | 
		
false | 
		
15 | 
	 
	
		| ApplyToAll | 
		Boolean | 
		If true modifications to ColorDefaultItems 
		and ColorDefaultChildren properties (see the table below) 
		are applied to all relevant 2D view scene items. If false (default) only 
		new items added after the call will be created with the specified color | 
		
false | 
		
16 | 
	 
	
		| UserData | 
		Integer | 
		Added to store any user / application defined number. 
		Not used by the component | 
		
0 | 
		
11 | 
	 
	 
	  
Properties of 2D View accessed via IKCContext2 
	
		| Name | 
		Type | 
		Description | 
		Deafult | 
		Context Parameter ID (for 
		IKCContext2 ) | 
	 
	
		| ColorDefaultItems | 
		Color | 
		Color of lines in the drawing. See description for the
		ApplyToAll property above | 
		 0, 0, 0 (black) | 
		0 | 
	 
	
		| ColorDefaultChildren | 
		Color | 
		Color of angle labels. See above | 
		1, 0, 0 (red) | 
		1 | 
	 
	
		| ColorRulerLines | 
		Color | 
		Color of lines in dimension annotations | 
		0, 0, 0.7843  | 
		2 | 
	 
	
		| ColorRulerText | 
		Color | 
		Color of dimension text | 
		
0, 0, 0.7843 | 
		
3 | 
	 
	
		| ColorBreakLine | 
		Color | 
		Color of break lines | 
		
0, 0, 0 | 
		
4 | 
	 
	
		| ColorOrientationText | 
		Color | 
		Color of Side / Orientation text | 
		
0.6274, 0.6274, 1 | 
		
5 | 
	 
	 
	 
	
	HorVisibleRange and
	VertVisibleRange properties 
	provide programmatic access to viewing rectangle of the displayed scene of a 
	2D view.  
	For example, increasing length of the horizontal range will result in 
	large area of 2D plane to be displayed in the current window so the model 
	will appear smaller, which has effect of zooming out. Reduction of the range 
	has effect of zooming in. 
	Translation of the horizontal range to the right will appear as if the 
	model has been shifted to the left, which has effect of pan operation. The 
	same is true for the vertical range. 
	To perform the above zoom / pan operations it is enough to modify only 
	one range of the two. The second one will be updated automatically. See 
	below for an explanation. 
	Note that ratio of lengths of the two ranges is constant and coincides 
	with aspect ratio (width / height) of the component's window, otherwise the 
	scene would look distorted. Because of that modification of one range 
	results in automatic modification of the other range inside the DG Kernel 
	component.  
	  
	Aligning of 2D Views
	Aligning allows horizontal or vertical 
	alignment of two screen images or metafile drawings. If two controls or two 
	metafile drawings are vertically aligned aligning windows (positioning at 
	the same horizontal location on the screen and making width equal) of both 
	controls or pictures guarantees that the drawing inside the window or 
	picture will be aligned too, i.e. they will have the same amount of empty 
	space on the left and the right side of the drawing and break lines, if 
	present in both, will be aligned vertically. 
	Aligning two controls is not completely symmetric. The first control is 
	the control to which the second control will be aligned to. 
	To align two controls or to align control to itself after a rotation of 
	Frame of 2D View:  
	
		- Query
	I2DView2_KC
	from I2DView_KC
	of both controls. Set SetupHorAlignment and/or 
	SetupVertAlignment property of the first control to true. 
 
		- Call I2DView2_KC.CreateTemplate 
		of I2DView2_KC of the second control to create target configuration of 
		the view as a view template
 
		- Call 
		I2DView2_KC.SetupAlignment 
	of I2DView2_KC of the first control to prepare the control for alignment
 
		- Call I2DView2_KC.CreateTemplate 
	of I2DView2_KC of the first control prepare the control to store the configuration of 
	the view in a view template. 
 
		- Call I2DView2_KC.Align of 
	I2DView2_KC of the second control to align the scene. 
 
	 
	
		The Setup...Alignment properties do not always improve layout. So it is 
	recommended experimenting with its value. Call
		I2DView2_KC.Align(NULL, 
	0) to stop alignment.
	
	See also Cross 
	View Sample 
	
                 |