예제 #1
0
        /// <summary>
        /// Clonelayer returns a TroubleTicketGraphicLayer instead of a TroubleTicketServerLayer, not actually a clone in this case.
        /// </summary>
        /// <returns></returns>
        public Layer CloneLayer()
        {
            TroubleTicketGraphicLayer ticketsLayer = new TroubleTicketGraphicLayer();
                ticketsLayer.Visible = true;
                ticketsLayer.Opacity = 1;
                ticketsLayer.ID = ticketLayerName;
                ticketsLayer.tickets = new Dictionary<int, TroubleTicket>();

                TicketSeverity += ticketsLayer.ChangeTicketGraphic;

                foreach (Graphic g in Graphics)
                {
                    TroubleTicket newTicket = new TroubleTicket();
                    newTicket.Geometry = Geometry.Clone(g.Geometry);
                    newTicket.MouseLeftButtonUp += troubleTicketLeftClick;
                    newTicket.Priority = (int)g.Attributes["Severity"];
                    newTicket.originalGraphic = g;

                    ticketsLayer.Graphics.Add(newTicket);
                    ticketsLayer.tickets.Add((int)g.Attributes["OBJECTID"], newTicket);
                    ticketsLayer.serverLayer = this;
                }

                return ticketsLayer;
        }
예제 #2
0
        public FeatureInfoTip(TroubleTicket g, TroubleTicketServerLayer ttsl)
        {
            InitializeComponent();
            myFeature = g;
            serverlayer = ttsl;

            // The server provides the severity as a short, while the control saves it as an int. When making the window, we must handle both cases.
            if (myFeature.originalGraphic.Attributes["Severity"] is System.Int16)
            {
                Priority = (short)(myFeature.originalGraphic.Attributes["Severity"]);
            }
            else if (myFeature.originalGraphic.Attributes["Severity"] is System.Int32)
            {
                Priority = (int)(myFeature.originalGraphic.Attributes["Severity"]);
            }

            TT_Num.Text = myFeature.originalGraphic.Attributes["OBJECTID"].ToString();
            TT_DES.Text = myFeature.originalGraphic.Attributes["Description"].ToString();
            TT_LOC.Text = "X: " + ((MapPoint)myFeature.Geometry).X + " Y: " + ((MapPoint)myFeature.Geometry).Y;

            ShowMapButton.Visibility = Visibility.Visible;
        }