Esempio n. 1
0
        private void lvResult_DoubleClick(object sender, EventArgs e)
        {
            if (lvResult.SelectedItems.Count == 0)
            {
                return;
            }

            ListViewItem lvi = lvResult.SelectedItems[0];

            if (lvi == null)
            {
                ResetView();
                return;
            }
            if (lvi.Tag == null)
            {
                ResetView();
                return;
            }

            ModelComparisonItem model = (ModelComparisonItem)lvi.Tag;

            if (model == null)
            {
                ResetView();
                return;
            }

            HighlightModel(model);
        }
Esempio n. 2
0
        private void HighlightModel(ModelComparisonItem model)
        {
            if (vizcore1.View.XRay.Enable == false)
                vizcore1.View.XRay.Enable = true;

            if (vizcore2.View.XRay.Enable == false)
                vizcore2.View.XRay.Enable = true;

            vizcore1.View.XRay.Clear();
            vizcore2.View.XRay.Clear();

            vizcore1.View.ResetView();
            vizcore2.View.ResetView();

            if (model.RESULT_EXIST_BOTH == true)
            {
                vizcore1.View.FlyToObject3d(new List<int>() { model.Node1.Index }, 1.0f);
                vizcore2.View.FlyToObject3d(new List<int>() { model.Node2.Index }, 1.0f);

                vizcore1.View.XRay.Select(new List<int>() { model.Node1.Index }, true);
                vizcore2.View.XRay.Select(new List<int>() { model.Node2.Index }, true);
            }
            else if(model.RESULT_EXIST_A == true)
            {
                vizcore1.View.FlyToObject3d(new List<int>() { model.Node1.Index }, 1.0f);
                //vizcore2.View.FlyToObject3d(new List<int>() { model.Node2.Index }, 1.0f);

                vizcore1.View.XRay.Select(new List<int>() { model.Node1.Index }, true);
                //vizcore2.View.XRay.Select(new List<int>() { model.Node2.Index }, true);
            }
            else
            {
                //vizcore1.View.FlyToObject3d(new List<int>() { model.Node1.Index }, 1.0f);
                vizcore2.View.FlyToObject3d(new List<int>() { model.Node2.Index }, 1.0f);

                //vizcore1.View.XRay.Select(new List<int>() { model.Node1.Index }, true);
                vizcore2.View.XRay.Select(new List<int>() { model.Node2.Index }, true);
            }
        }
Esempio n. 3
0
        private void btnCompare_Click(object sender, EventArgs e)
        {
            List <VIZCore3D.NET.Data.Node> node1 = vizcore1.Object3D.FromFilter(VIZCore3D.NET.Data.Object3dFilter.ALL, true);
            List <VIZCore3D.NET.Data.Node> node2 = vizcore2.Object3D.FromFilter(VIZCore3D.NET.Data.Object3dFilter.ALL, true);

            Dictionary <string, VIZCore3D.NET.Data.Node> map1 = vizcore1.Object3D.GetNodePathMap();
            Dictionary <string, VIZCore3D.NET.Data.Node> map2 = vizcore2.Object3D.GetNodePathMap();

            List <ModelComparisonItem> result = new List <ModelComparisonItem>();

            foreach (KeyValuePair <string, VIZCore3D.NET.Data.Node> item in map1)
            {
                ModelComparisonItem model = new ModelComparisonItem();

                if (map2.ContainsKey(item.Key) == true)
                {
                    model.Node1 = item.Value;
                    model.Node2 = map2[item.Key];

                    model.BBox1 = vizcore1.Object3D.GeometryProperty.FromIndex(item.Value.Index, false).GetBoundBox();
                    model.BBox2 = vizcore2.Object3D.GeometryProperty.FromIndex(model.Node2.Index, false).GetBoundBox();

                    if (item.Value.Kind == VIZCore3D.NET.Data.NodeKind.PART)
                    {
                        model.MeshCount1 = vizcore1.Object3D.GetMeshCount(item.Value.Index);
                        model.MeshCount2 = vizcore2.Object3D.GetMeshCount(model.Node2.Index);
                    }

                    model.RESULT_EXIST_A    = true;
                    model.RESULT_EXIST_B    = true;
                    model.RESULT_EXIST_BOTH = true;

                    model.Compare();
                }
                else
                {
                    model.Node1 = item.Value;
                    //model.Node2 = map2[item.Key];

                    model.BBox1 = vizcore1.Object3D.GeometryProperty.FromIndex(item.Value.Index, false).GetBoundBox();
                    //model.BBox2 = vizcore2.Object3D.GeometryProperty.FromIndex(model.Node2.Index, false).GetBoundBox();

                    if (item.Value.Kind == VIZCore3D.NET.Data.NodeKind.PART)
                    {
                        model.MeshCount1 = vizcore1.Object3D.GetMeshCount(item.Value.Index);
                        //model.MeshCount2 = vizcore2.Object3D.GetMeshCount(model.Node2.Index);
                    }

                    model.RESULT_EXIST_A    = true;
                    model.RESULT_EXIST_B    = false;
                    model.RESULT_EXIST_BOTH = false;
                }

                result.Add(model);
            }

            foreach (KeyValuePair <string, VIZCore3D.NET.Data.Node> item in map2)
            {
                ModelComparisonItem model = new ModelComparisonItem();

                if (map1.ContainsKey(item.Key) == false)
                {
                    model.Node2 = item.Value;

                    //model.BBox1 = vizcore1.Object3D.GeometryProperty.FromIndex(item.Value.Index, false).GetBoundBox();
                    model.BBox2 = vizcore2.Object3D.GeometryProperty.FromIndex(model.Node2.Index, false).GetBoundBox();

                    if (item.Value.Kind == VIZCore3D.NET.Data.NodeKind.PART)
                    {
                        //model.MeshCount1 = vizcore1.Object3D.GetMeshCount(item.Value.Index);
                        model.MeshCount2 = vizcore2.Object3D.GetMeshCount(model.Node2.Index);
                    }

                    model.RESULT_EXIST_A    = false;
                    model.RESULT_EXIST_B    = true;
                    model.RESULT_EXIST_BOTH = false;

                    result.Add(model);
                }
            }

            lvResult.BeginUpdate();
            lvResult.Items.Clear();
            foreach (ModelComparisonItem item in result)
            {
                ListViewItem lvi = new ListViewItem(item.GetListViewItem());
                lvi.Tag = item;

                if (ckResultViewType.Checked == true)
                {
                    if (item.IsSameModel() == false)
                    {
                        lvResult.Items.Add(lvi);
                    }
                }
                else
                {
                    lvResult.Items.Add(lvi);
                }
            }
            lvResult.EndUpdate();
        }