public async Task <IView> addView(EngineeringMap eMap, bool canClose)
        {
            LayoutDocumentPane docPane = FindViewHolder();

            if (docPane == null)
            {
                docPane = ViewPane;
            }

            LayoutDocument LayoutDoc = new LayoutDocument();

            LayoutDoc.ContentId = eMap.MapID;
            LayoutDoc.Title     = eMap.MapID;
            LayoutDoc.CanClose  = canClose;
            LayoutDoc.Closed   += LayoutDoc_Closed;
            docPane.Children.Add(LayoutDoc);

            string datafilePath, filePath;

            if (_prj != null)
            {
                datafilePath = _prj.projDef.LocalFilePath;
                filePath     = datafilePath + "\\" + eMap.MapID + ".xml";
            }

            IView view = null;

            if (eMap.MapType == EngineeringMapType.FootPrintMap)
            {
                PlanView planView = new PlanView(this, _prj, eMap);
                LayoutDoc.Content = planView;
                view = planView.view;
            }
            else if (eMap.MapType == EngineeringMapType.GeneralProfileMap)
            {
                ProfileView profileView = new ProfileView(this, _prj, eMap);
                LayoutDoc.Content = profileView;
                view = profileView.view;
            }
            else if (eMap.MapType == EngineeringMapType.Map3D)
            {
                U3DView u3dView = new U3DView(this, _prj, eMap);
                LayoutDoc.Content = u3dView;
                view = u3dView.view;
            }

            // view is both a trigger and listener of object selection changed event
            view.objSelectionChangedTrigger += this.objSelectionChangedListener;
            this.objSelectionChangedTrigger += view.objSelectionChangedListener;
            view.initializeView();

            // Load predefined layers
            await view.loadPredefinedLayers();

            // Sync view graphics with data
            view.syncObjects();

            _views.Add(view);
            return(view);
        }
Пример #2
0
        public async Task<IView> addView(EngineeringMap eMap, bool canClose)
        {
            LayoutDocumentPane docPane = FindViewHolder();
            if (docPane == null)
                docPane = ViewPane;

            LayoutDocument LayoutDoc = new LayoutDocument();
            LayoutDoc.ContentId = eMap.MapID;
            LayoutDoc.Title = eMap.MapID;
            LayoutDoc.CanClose = canClose;
            LayoutDoc.Closed += LayoutDoc_Closed;
            docPane.Children.Add(LayoutDoc);
            
            string datafilePath, filePath;
            if (_prj != null)
            {
                datafilePath = _prj.projDef.LocalFilePath;
                filePath = datafilePath + "\\" + eMap.MapID + ".xml";
            }

            IView view = null;
            if (eMap.MapType == EngineeringMapType.FootPrintMap)
            {
                PlanView planView = new PlanView(this, _prj, eMap);
                LayoutDoc.Content = planView;
                view = planView.view;
            }
            else if (eMap.MapType == EngineeringMapType.GeneralProfileMap)
            {
                ProfileView profileView = new ProfileView(this, _prj, eMap);
                LayoutDoc.Content = profileView;
                view = profileView.view;
            }
            else if (eMap.MapType == EngineeringMapType.Map3D)
            {
                U3DView u3dView = new U3DView(this, _prj, eMap);
                LayoutDoc.Content = u3dView;
                view = u3dView.view;
            }

            // view is both a trigger and listener of object selection changed event
            view.objSelectionChangedTrigger += this.objSelectionChangedListener;
            this.objSelectionChangedTrigger += view.objSelectionChangedListener;
            view.initializeView();

            // Load predefined layers
            await view.loadPredefinedLayers();

            // Sync view graphics with data
            view.syncObjects();

            _views.Add(view);
            return view;
        }