示例#1
0
        /// <summary>
        /// - Generates IFCProject-related items
        /// - Generates Not-referenced-in-structure items
        /// - Generates Header info
        /// - Generates check box per items
        /// </summary>
        public void BuildTree(ViewController ifcViewer, IntPtr ifcModel, IFCItem ifcRoot, TreeView treeControl)
        {
            treeControl.Items.Clear();

            if (ifcViewer == null) {
                throw new ArgumentException("The viewer is null.");
            }

            if (ifcModel == IntPtr.Zero) {
                throw new ArgumentException("Invalid model.");
            }

            if (ifcRoot == null) {
                throw new ArgumentException("The root is null.");
            }

            if (treeControl == null) {
                throw new ArgumentException("The tree control is null.");
            }

            _viewController = ifcViewer;
            _ifcModel = ifcModel;
            _ifcRoot = ifcRoot;
            _treeControl = treeControl;

            _dicCheckedElements.Clear();

            CreateHeaderTreeItems();
            CreateProjectTreeItems();
            CreateNotReferencedTreeItems();
        }
示例#2
0
        public MainViewModel(Viewport3DX viewport, TreeView treeview)
        {
            // ----------------------------------------------
            // titles
            this.Title = "Ifc Viewer";
            this.SubTitle = "By LinJiarui";

            // ----------------------------------------------
            // camera setup
            this.Camera = new PerspectiveCamera { Position = new Point3D(8, 9, 7), LookDirection = new Vector3D(-5, -12, -5), UpDirection = new Vector3D(0, 0, 1) };

            // ----------------------------------------------
            // setup scene
            this.AmbientLightColor = new Color4(0.2f, 0.2f, 0.2f, 1.0f);

            this.RenderLight1 = true;
            this.RenderLight2 = false;
            this.RenderLight3 = false;
            this.RenderLight4 = true;

            this.Light1Color = (Color4)Color.White;
            this.Light2Color = (Color4)Color.Red;
            this.Light3Color = (Color4)Color.LightYellow;
            this.Light4Color = (Color4)Color.LightBlue;

            this.Light2Attenuation = new Vector3(1.0f, 0.5f, 0.10f);
            this.Light3Attenuation = new Vector3(1.0f, 0.1f, 0.05f);
            this.Light4Attenuation = new Vector3(1.0f, 0.2f, 0.0f);

            this.Light1Direction = new Vector3(0, -10, -10);
            this.Light1Transform = new TranslateTransform3D(-Light1Direction.ToVector3D());
            //            this.Light1DirectionTransform = CreateAnimatedTransform2(-Light1Direction.ToVector3D(), new Vector3D(0, 1, -1), 24);

            //            this.Light2Transform = CreateAnimatedTransform1(new Vector3D(-4, 0, 0), new Vector3D(0, 0, 1), 3);
            //            this.Light3Transform = CreateAnimatedTransform1(new Vector3D(0, 0, 4), new Vector3D(0, 1, 0), 5);

            this.Light4Direction = new Vector3(0, -5, 0);
            this.Light4Transform = new TranslateTransform3D(-Light4Direction.ToVector3D());
            //            this.Light4DirectionTransform = CreateAnimatedTransform2(-Light4Direction.ToVector3D(), new Vector3D(1, 0, 0), 12);

            // ----------------------------------------------
            // light model3d
            var sphere = new MeshBuilder();
            sphere.AddSphere(new Vector3(0, 0, 0), 0.2);
            Sphere = sphere.ToMeshGeometry3D();
            this.LightModelMaterial = new PhongMaterial {
                AmbientColor = Color.Gray,
                DiffuseColor = Color.Gray,
                EmissiveColor = Color.Yellow,
                SpecularColor = Color.Black,
            };

            viewController = new ViewController();
            Model = new Element3DCollection();
            viewController.InitGraphics(viewport, Model, treeview);
        }