///<summary>初始化图例视图</summary> private void initLegend() { //初始化图例视图 Legend3DData legendData; legendData = new Legend3DData(); LegendUnit lg; lg = legendData.addNewModelLegend(EModelType.平滑园柱); lg.LegendName = rootTitle; lg.SizeXName = sectionTitle; lg.SizeYName = heightTitle; lg.mat = My3DHelper.getSolidMaterial(EMaterailColor.红, EMaterialColorDeep.浅色); legendView = new Legend3D(legendData); legendView.Visibility = Visibility.Hidden; grdMain.Children.Add(legendView); //附加图例按钮 Image img = new Image() { Width = 48, Height = 48, Margin = new Thickness(0, 60, 0, 5), Cursor = Cursors.Hand, VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Center }; img.ToolTip = "图例说明"; BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = new Uri("pack://application:,,,/TreeCylinder3D;component/Images/legend.png", UriKind.RelativeOrAbsolute); bi.EndInit(); img.Source = bi; img.MouseLeftButtonDown += new MouseButtonEventHandler(imgLegend_MouseLeftButtonDown); controller3D.addControl(img); }
protected virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { controller3D.ClearaddControl(); legendView = null; _datas.camera = null; _datas.mgFlag.Children.Clear(); _datas.mgLabel.Children.Clear(); _datas.mgModel.Children.Clear(); _datas.mgAll.Children.Clear(); _datas.root.clearNode(); _datas.root = null; _datas.mgAll = null; _datas = null; controller3D.showTooltips = null; controller3D.showDetail = null; controller3D.mainViewport3D = null; controller3D.clearDynControl(); controller3D = null; GC.Collect(); GC.WaitForFullGCComplete(); } disposed = true; } }