Esempio n. 1
0
        public static XElement EngineeringMapToXml(EngineeringMap eMap)
        {
            XElement root = new XElement("EngineeringMap",
                new XAttribute("MapID", eMap.MapID),
                new XAttribute("LocalTileFileName1", eMap.LocalTileFileName1),
                new XAttribute("LocalTileFileName2", eMap.LocalTileFileName2),
                new XAttribute("LocalMapFileName", eMap.LocalMapFileName),
                new XAttribute("LocalGeoDbFileName", eMap.LocalGeoDbFileName),
                new XAttribute("MapUrl", eMap.MapUrl),
                new XAttribute("XMax", eMap.XMax),
                new XAttribute("XMin", eMap.XMin),
                new XAttribute("YMax", eMap.YMax),
                new XAttribute("YMin", eMap.YMin),
                new XAttribute("MinimumResolution", eMap.MinimumResolution),
                new XAttribute("MapType", eMap.MapType.ToString()),
                new XAttribute("Calibrated", eMap.Calibrated),
                new XAttribute("Scale", eMap.Scale),
                new XAttribute("ScaleX", eMap.ScaleX),
                new XAttribute("ScaleY", eMap.ScaleY),
                new XAttribute("ScaleZ", eMap.ScaleZ)
                );

            //XElement parent = new XElement("ELayers");
            //foreach (EngineeringLayer eLayer in eMap.ELayers)
            //{
            //    XElement node = EngineeringLayerToXml(eLayer);
            //    parent.Add(node);
            //}
            //root.Add(parent);

            return root;
        }
Esempio n. 2
0
        public U3DView(MainFrame mainFrame, Project prj, EngineeringMap eMap)
        {
            InitializeComponent();

            _mainFrame = mainFrame;
            _view3D = new IS3View3D(this, u3dPlayerControl);
            _view3D.prj = prj;
            _view3D.eMap = eMap;
        }
Esempio n. 3
0
        public ProfileView(MainFrame mainFrame, Project prj, EngineeringMap eMap)
        {
            InitializeComponent();

            _mainFrame = mainFrame;
            _view = new IS3ProfileView(this, MyMapView);
            _view.prj = prj;
            _view.eMap = eMap;
            MyProgressBar.DataContext = _view;

            GotFocus += ProfileView_GotFocus;
            MyDrawToolControl.drawToolClickEventHandler += _view.drawToolsClickEventListener;
            MyDrawToolControl.drawToolClickEventHandler += (o, e) =>
            {
                if (e.stopDraw)
                    DrawStrip.Visibility = Visibility.Collapsed;
            };
        }
Esempio n. 4
0
        public EditEMapWindow(MainFrame mainFrame, EngineeringMap eMap)
        {
            _mainFrame = mainFrame;
            _eMap = eMap;

            if (_eMap == null)
            {
                _eMap = new EngineeringMap();
                int count = _mainFrame.views.Count() + 1;
                _eMap.MapID = "MyView" + count.ToString();
                _eMap.MapType = EngineeringMapType.FootPrintMap;
                _eMap.MinimumResolution = 0.01;
            }

            InitializeComponent();

            if (_eMap.MapType == EngineeringMapType.FootPrintMap)
                MapType.SelectedIndex = 0;
            else if (_eMap.MapType == EngineeringMapType.GeneralProfileMap)
                MapType.SelectedIndex = 1;

            Root.DataContext = _eMap;
        }
Esempio n. 5
0
        // Helper function
        // Get tunnel profile axis
        //
        public static TunnelAxis GetTunnelProfileAxis(int lineNo, EngineeringMap eMap)
        {
            Domain domain = HelperFunction.GetAnalysisDomain();
            DGObjectsCollection lps = domain.getObjects("LPResult");
            if (lps == null)
                return null;

            Tunnel tunnel = GetTunnel(lineNo);
            if (tunnel == null)
            {
                return null;
            }

            string name = tunnel.id.ToString() + eMap.MapID;

            LPResult lpResult = lps[name] as LPResult;
            if (lpResult == null)
            {
                return null;
            }
            TunnelAxis profileAxis = lpResult.ProfileAxis;
            return profileAxis;
        }
        public static EngineeringMap EngineeringMapFromXml(XElement el)
        {
            if (el.Name.ToString() == "EngineeringMap")
            {
                EngineeringMap eMap = new EngineeringMap();

                XAttribute attr = el.Attribute("MapID");
                if (attr != null)
                    eMap.MapID = (string)attr;
                attr = el.Attribute("LocalTileFileName1");
                if (attr != null)
                    eMap.LocalTileFileName1 = (string)attr;
                attr = el.Attribute("LocalTileFileName2");
                if (attr != null)
                    eMap.LocalTileFileName2 = (string)attr;
                attr = el.Attribute("LocalMapFileName");
                if (attr != null)
                    eMap.LocalMapFileName = (string)attr;
                attr = el.Attribute("LocalGeoDbFileName");
                if (attr != null)
                    eMap.LocalGeoDbFileName = (string)attr;
                attr = el.Attribute("MapUrl");
                if (attr != null)
                    eMap.MapUrl = (string)attr;
                attr = el.Attribute("XMax");
                if (attr != null)
                    eMap.XMax = (double)attr;
                attr = el.Attribute("XMin");
                if (attr != null)
                    eMap.XMin = (double)attr;
                attr = el.Attribute("YMax");
                if (attr != null)
                    eMap.YMax = (double)attr;
                attr = el.Attribute("YMin");
                if (attr != null)
                    eMap.YMin = (double)attr;
                attr = el.Attribute("MinimumResolution");
                if (attr != null)
                    eMap.MinimumResolution = (double)attr;
                attr = el.Attribute("MapType");
                if (attr != null)
                {
                    EngineeringMapType mapType = EngineeringMapType.FootPrintMap;
                    Enum.TryParse(attr.Value, out mapType);
                    eMap.MapType = mapType;
                }
                attr = el.Attribute("Calibrated");
                if (attr != null)
                    eMap.Calibrated = (bool)attr;
                attr = el.Attribute("Scale");
                if (attr != null)
                    eMap.Scale = (double)attr;
                attr = el.Attribute("ScaleX");
                if (attr != null)
                    eMap.ScaleX = (double)attr;
                attr = el.Attribute("ScaleY");
                if (attr != null)
                    eMap.ScaleY = (double)attr;
                attr = el.Attribute("ScaleZ");
                if (attr != null)
                    eMap.ScaleZ = (double)attr;

                //XElement eLayers = el.Element("ELayers");
                //if (eLayers != null)
                //{
                //    IEnumerable<XElement> eles = eLayers.Elements("ELayer");
                //    foreach (XElement iter in eles)
                //    {
                //        EngineeringLayer eLayer = EngineeringLayerFromXml(iter);
                //        if (eLayer != null)
                //            eMap.ELayers.Add(eLayer);
                //    }
                //}
                return eMap;
            }
            return null;
        }
Esempio n. 7
0
        public static LPResult ProjectTunnel_LS(EngineeringMap targetEMap, DGObject obj, 
            ISpatialReference sp, DrawTunnelsSettings lsSettings)
        {
            IPolyline projLine = targetEMap.profileLine;
            if (projLine == null)
                return null;

            Tunnel tunnel = obj as Tunnel;
            if (tunnel.LineNo == null)
                return null;
            int lineNo = tunnel.LineNo.Value;
            double mapScale = targetEMap.Scale;

            Domain domain = Globals.project.getDomain(DomainType.Structure);
            DGObjectsCollection allAxes = domain.getObjects("TunnelAxis");
            TunnelAxis axis = allAxes[tunnel.id] as TunnelAxis;
            if (axis == null)
                return null;

            double distance = 0;
            IMapPoint pt = Runtime.geometryEngine.newMapPoint(0, 0, sp);
            IMapPoint prjPt = Runtime.geometryEngine.newMapPoint(0, 0,sp);
            List<IMapPoint> upperPnts = new List<IMapPoint>();
            List<IMapPoint> lowerPnts = new List<IMapPoint>();
            int num = axis.AxisPoints.Count;
            double height = 0.0;
            if (tunnel.Height != null)
                height = tunnel.Height.Value;

            TunnelAxis profileAxis = new TunnelAxis();
            List<TunnelAxisPoint> pts = new List<TunnelAxisPoint>();
            profileAxis.AxisPoints = pts;
            profileAxis.LineNo = lineNo;

            for (int i = 0; i < num; ++i)
            {
                TunnelAxisPoint axisPt = axis.AxisPoints[i];
                pt = Runtime.geometryEngine.newMapPoint(axisPt.X, axisPt.Y, sp);

                GeomUtil.ProjectPointToPolyline(pt,
                    projLine.GetPoints(), ref distance, ref prjPt);
                distance /= mapScale;
                distance += lsSettings.xOffset;

                double X = distance;
                double Y = (axisPt.Z + height / 2.0) * lsSettings.zScale;
                IMapPoint upperPnt = Runtime.geometryEngine.newMapPoint(X, Y, sp);
                upperPnts.Add(upperPnt);

                X = distance;
                Y = (axisPt.Z - height / 2.0) * lsSettings.zScale;
                IMapPoint lowerPnt = Runtime.geometryEngine.newMapPoint(X, Y, sp);
                lowerPnts.Add(lowerPnt);

                TunnelAxisPoint newPt = new TunnelAxisPoint();
                newPt.X = distance;
                newPt.Z = axisPt.Z * lsSettings.zScale;
                newPt.Mileage = axisPt.Mileage;
                profileAxis.AxisPoints.Add(newPt);
            }
            lowerPnts.Reverse();
            upperPnts.AddRange(lowerPnts);
            upperPnts.Add(upperPnts[0]);

            IPointCollection tunnelPnts = Runtime.geometryEngine.newPointCollection();
            foreach (IMapPoint mp in upperPnts)
                tunnelPnts.Add(mp);
            IGraphic g = Runtime.graphicEngine.newPolygon(tunnelPnts);

            ISimpleLineSymbol linesymbol = Runtime.graphicEngine.newSimpleLineSymbol(
                                Colors.Black, Core.Graphics.SimpleLineStyle.Solid, 0.5);
            ISymbol symbol = Runtime.graphicEngine.newSimpleFillSymbol(
                                Colors.Red, SimpleFillStyle.Solid, linesymbol);
            g.Symbol = symbol;

            LPResult result = new LPResult();
            result.id = obj.id;
            result.name = obj.id.ToString() + targetEMap.MapID;
            result.Obj = obj;
            result.Graphic = g;
            result.PlanAxis = axis;
            result.ProfileAxis = profileAxis;
            result.Setting = lsSettings;
            return result;
        }
Esempio n. 8
0
        // Project tunnels to longitudinal section
        //
        public static List<LPResult> ProjectTunnels_LS(EngineeringMap targetEMap,
            IList objList, ISpatialReference sp,
            DrawTunnelsSettings lsSettings)
        {
            List<LPResult> results = new List<LPResult>();

            foreach (DGObject obj in objList)
            {
                LPResult result = ProjectTunnel_LS(targetEMap, obj, sp, lsSettings);
                if (result != null)
                {
                    results.Add(result);
                }
            }
            return results;
        }
Esempio n. 9
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;
        }