Select to view content in your preferred language

need to add measure tool

3175
6
01-24-2012 10:27 AM
ErnejunCorvera
New Contributor III
Hi. I have a Map Viewer for Silverlight running and functioning well. What i need is to add a measure tool so that the user could be able to measure distances on the map. I am not a programmer and i am new to this silverlight application. What i have to do?...any help is much appreciated. Thanks.:)
0 Kudos
6 Replies
DerekLaw
Esri Esteemed Contributor
Hi Ernejun,

What i need is to add a measure tool so that the user could be able to measure distances on the map.


We are working on an "add-in" sample measure tool which should be available sometime mid-late February.

Hope this helps,
0 Kudos
RyanKoehnen
New Contributor III
Hi. I have a Map Viewer for Silverlight running and functioning well. What i need is to add a measure tool so that the user could be able to measure distances on the map. I am not a programmer and i am new to this silverlight application. What i have to do?...any help is much appreciated. Thanks.:)


You can do it through an addin, but you would need to do some programming 😉 Here's an example...

****Measure tool command class***
    public class MeasureActionTool : ICommand
    {
        #region ICommand members
        public void Execute(object parameter)
        {
            SolidColorBrush b = new SolidColorBrush();
            b.Color = Colors.Orange;

            SimpleLineSymbol ls = new SimpleLineSymbol();
            ls.Color = b;
            ls.Width = 2;

            ViewerMeasureAction m = new ViewerMeasureAction()
            {
                LineSymbol = ls,
                MeasureMode = MeasureAction.Mode.Polyline,
                DisplayTotals = true,
                DistanceUnit = DistanceUnit.Feet,
            };

            m.Attach(MapApplication.Current.Map);

            m.Execute();
        }

        public bool CanExecute(object parameter)
        {
            // Return true so that the command can always be executed
            return true;
        }

        public event EventHandler CanExecuteChanged;

        #endregion
    }


***Wrapper class for the Silverlight measure tool***
    public class ViewerMeasureAction : MeasureAction
    {
        public void Execute()
        {
            Invoke(null);
        }
    }
0 Kudos
ErnejunCorvera
New Contributor III
Glad to hear that Mr. Law..

Thanks also mr. koeh0017..i'll try to this myself and hope i can make it..thanks for the code.
0 Kudos
JohnGravois
Frequent Contributor
Our development team has released a production quality, ready-to-use Measure Add-in for the Silverlight Viewer.

Measure Tool
http://www.arcgis.com/home/item.html?id=7530abad98bd471da53a2d1716928c40
0 Kudos
RichZwaap
Occasional Contributor III
We are working on an "add-in" sample measure tool


This has just been made available here.  This is production quality, ready-to-use tool with full source code.
0 Kudos
TannerKneese
New Contributor
I received the below error after uploading the xap file... help?
0 Kudos