本文整理汇总了C#中GridNode.SetCellCount方法的典型用法代码示例。如果您正苦于以下问题:C# GridNode.SetCellCount方法的具体用法?C# GridNode.SetCellCount怎么用?C# GridNode.SetCellCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridNode
的用法示例。
在下文中一共展示了GridNode.SetCellCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: customGridToolStripMenuItem_Click
private void customGridToolStripMenuItem_Click(object sender, EventArgs e)
{
WorkingPlane wp = renderView.Renderer.GetWorkingPlane();
GridNode gridNode = new GridNode();
Vector3 modelSize = renderView.SceneManager.GetBBox().Size();
Vector2 cellSize = gridNode.GetCellSize();
int nCountX = (int)(modelSize.X / cellSize.X + 0.5f) + 1;
int nCountY = (int)(modelSize.Y / cellSize.Y + 0.5f) + 1;
if (nCountX < 2)
nCountX = 2;
if (nCountY < 2)
nCountY = 2;
gridNode.SetCellCount(nCountX, nCountY);
LineStyle lineStyle = new LineStyle();
lineStyle.SetColor(new ColorValue(1.0f, 1.0f, 1.0f));
lineStyle.SetPatternStyle((int)EnumLinePattern.LP_DotLine);
{
//Z
LineNode lineNode = new LineNode();
lineNode.Set(new Vector3(0, 0, -1000), new Vector3(0, 0, 1000));
lineNode.SetLineStyle(lineStyle);
gridNode.AddNode(lineNode);
}
{
//X
LineNode lineNode = new LineNode();
lineNode.Set(new Vector3(-1000, 0, 0), new Vector3(1000, 0, 0));
lineNode.SetLineStyle(lineStyle);
gridNode.AddNode(lineNode);
}
{
//Y
LineNode lineNode = new LineNode();
lineNode.Set(new Vector3(0, -1000, 0), new Vector3(0, 1000, 0));
lineNode.SetLineStyle(lineStyle);
gridNode.AddNode(lineNode);
}
lineStyle = new LineStyle();
lineStyle.SetColor(new ColorValue(0.9f, 0.9f, 0.9f));
gridNode.SetLineStyle(lineStyle);
for (int ii = -1; ii <= nCountX; ++ii)
{
if (ii == 0)
continue;
LineNode lineNode = new LineNode();
lineNode.Set(new Vector3(ii * cellSize.X, cellSize.Y, 0), new Vector3(ii * cellSize.X, -nCountY * cellSize.Y, 0));
gridNode.AddNode(lineNode);
}
for (int ii = -1; ii <= nCountY; ++ii)
{
if (ii == 0)
continue;
LineNode lineNode = new LineNode();
lineNode.Set(new Vector3(-cellSize.X, -ii * cellSize.Y, 0), new Vector3(nCountX * cellSize.X, -ii * cellSize.Y, 0));
gridNode.AddNode(lineNode);
}
gridNode.Update();
wp.SetGridNode(gridNode);
{
AxesWidget xwh = new AxesWidget();
xwh.EnableLeftHandCS();
xwh.SetArrowText((int)EnumAxesDirection.Axes_Y, "w");
xwh.SetArrowText((int)EnumAxesDirection.Axes_Z, "h");
ScreenWidget coordWidget = new ScreenWidget();
coordWidget.SetNode(xwh);
coordWidget.SetWidgetPosition((int)EnumWidgetPosition.WP_BottomLeft);
renderView.Renderer.AddWidgetNode(coordWidget);
}
{
AxesWidget yz = new AxesWidget();
yz.ShowArrow((int)EnumAxesDirection.Axes_X, false);
ScreenWidget coordWidget = new ScreenWidget();
coordWidget.SetNode(yz);
coordWidget.SetWidgetPosition((int)EnumWidgetPosition.WP_BottomRight);
renderView.Renderer.AddWidgetNode(coordWidget);
}
renderView.ShowCoordinateAxis(false);
renderView.RequestDraw();
}