Select to view content in your preferred language

How do you add a graphic layer to a Mobile 10 Project?

2674
3
Jump to solution
06-23-2011 07:59 AM
GenaroGarcia
Deactivated User
I have created a task to find a given address, get the coordinates, set the extent, and zoom into the extent.
I'm needing to create a graphic layer, add the coordinates to the graphic layer, and display it on the project map.

Any ideas?
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
Original User: AkhilP

In this thread you will see how to create a graphic layer, in particular look at buddha's post and my posts for full code snippets.
http://forums.arcgis.com/threads/17001-PointPaintOperation-(Coloring-the-points-using-my-color-schem...

View solution in original post

0 Kudos
3 Replies
by Anonymous User
Not applicable
Original User: AkhilP

In this thread you will see how to create a graphic layer, in particular look at buddha's post and my posts for full code snippets.
http://forums.arcgis.com/threads/17001-PointPaintOperation-(Coloring-the-points-using-my-color-schem...
0 Kudos
GenaroGarcia
Deactivated User
This is for a WPF, how about a WinForms?
Is it different?
0 Kudos
GenaroGarcia
Deactivated User
Took a little thinking to get it done.
A big thanks.....



            //
            // --- Place Marker on Graphic Layer
            //
            flayer = MobileApplication.Current.Project.FindFeatureLayer(FFLayer);
            //
            // --- Declare graphic layer
            //
            GraphicLayer glSelected = new GraphicLayer();
            //
            // --- Get geometry of selected feature
            //
            using (FeatureDataReader fDataReader = flayer.GetDataReader(queryFilter))
            {
                while (fDataReader.Read())
                {
                    pgeometry = fDataReader[fDataReader.GeometryColumnIndex] as ESRI.ArcGIS.Mobile.Geometries.Geometry;
                    //glSelected.GeometryBag.Add(pgeometry);
                }
            }
            //
            // --- Create the point to be displayed
            //
            System.Windows.Media.SolidColorBrush myBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Aqua);

            System.Windows.Media.Pen myPen = new System.Windows.Media.Pen();
            myPen.Brush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Aquamarine);

            glSelected.Fill = myBrush;
            glSelected.DrawingPen = myPen;
            //
            // --- Create the graphic layer - point to the map
            //
            ESRI.ArcGIS.Mobile.WPF.Map mMap = MobileApplication.Current.Map;
            mMap.MapGraphicLayers.Add(glSelected);
            //
            // --- Add geometry point to graphic layer
            //
            glSelected.GeometryBag.Add(pgeometry);
            //
            //MessageBox.Show("X Coordinate: " + pgeometry.CurrentCoordinate.X + "\n\r" +
            //                "Y Coordinate: " + pgeometry.CurrentCoordinate.Y);
0 Kudos