コード例 #1
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // OBJECT
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// </summary>
        public MainViewModel()
        {
            simConfigModel = new SimConfigModel();

            // Build tool items
            this.toolItems = new DeferrableObservableCollection<ToolItemViewModel>();

            // Tool 3
            Tool3ViewModel viewModel3 = new Tool3ViewModel();
            viewModel3.Name = "DisplayOptions";
            viewModel3.Title = "Doc Display Options";
            viewModel3.DefaultDock = Dock.Right;
            viewModel3.DockGroup = "RightGroup";
            viewModel3.IsInitiallyAutoHidden = false;
            this.toolItems.Add(viewModel3);

            // Tool 2
            Tool2ViewModel viewModel = new Tool2ViewModel();
            viewModel.DefaultDock = Dock.Bottom;
            viewModel.DockGroup = "BottomGroup";
            viewModel.TextOutput = "0";
            this.toolItems.Add(viewModel);

            // Sim Config
            SimConfigViewModel simConfigViewModel = new SimConfigViewModel(simConfigModel);
            simConfigViewModel.DefaultDock = Dock.Left;
            simConfigViewModel.DockGroup = "LeftGroup";
            this.toolItems.Add(simConfigViewModel);

            // Tool 3
            //Tool3ViewModel viewModel3 = new Tool3ViewModel();
            //viewModel3.DefaultDock = Dock.Left;
            //viewModel3.DockGroup = "HiddenGroup";
            //viewModel3.IsInitiallyAutoHidden = true;
            //this.toolItems.Add(viewModel3);

            this.simModel = new SimulationModel(simConfigModel);

            this.AddNewDocument("VTKDocument");

            this.AddNewDocument("TextDocument");
        }
コード例 #2
0
        public VTKDataModel(SimulationModel sm)
        {
            simModel = sm;

            int numCells = sm.Cells.Count;

            cellIDs = vtkIntArray.New();
            cellIDs.SetNumberOfComponents(1);
            cellIDs.SetNumberOfValues(numCells);
            cellIDs.SetName(cellIdsArrayName);

            cellTypes = vtkIntArray.New();
            cellTypes.SetNumberOfComponents(1);
            cellTypes.SetNumberOfValues(numCells);
            cellTypes.SetName(cellTypeArrayName);

            points = vtkPoints.New();
            points.SetNumberOfPoints(numCells);

            verts = vtkCellArray.New();
            verts.Allocate(verts.EstimateSize(1, numCells), 1000);
            verts.InsertNextCell(numCells);

            foreach (MotileCell cell in sm.Cells)
            {
                int i = cell.CellId;
                int c = cell.CellType;
                double[] p = cell.Position;
                points.SetPoint(i, p[0], p[1], p[2]);
                cellIDs.SetValue(i, i);
                cellTypes.SetValue(i, c);
                verts.InsertCellPoint(i);
            }

            poly = vtkPolyData.New();
            poly.SetPoints(points);
            poly.SetVerts(verts);
            poly.GetPointData().AddArray(cellIDs);
            poly.GetPointData().AddArray(cellTypes);
        }