Tag: .NET

What’s new in the ArcGIS Runtime SDK for WPF 10.1.1?

‘Tis the season for “What’s New” blog posts, right? That’s because the the ArcGIS Runtime SDKs are releasing at the same time, give or take a day or two, to ring in the 2013 new year! So, in keeping with this trend , we bring you some exciting insights into what is about to be released in the ArcGIS Runtime SDK for WPF product. EDN subscribers can look for this important update on the Customer Care portal shortly before Christmas (which is coming up way too fast!). The formal announcement will be forthcoming. As you may have heard, these SDK version numbers have been synchronized as “10.1.1″. Stay tuned for more information about this and why this makes sense. Continue reading

Posted in Developer | Tagged , , | 7 Comments

Free Seminar on ArcGIS Runtime SDK for WPF

For all you developers make sure and check out the upcoming live training seminar on ArcGIS Runtime for WPF on Thursday, August 23rd.

Continue reading

Posted in Developer | Tagged , , , , , | Leave a comment

Developer Summit Europe

To build on the success of recent Developer Summit in California, we’ve decided to take the event on the road. Esri will be hosting 3 Dev Summits in Europe this September.

I hope developers from all over Europe and the world will come together in Rotterdam, Berlin or London (all 3 if you want). The technical sessions will focus on becoming more effective at building web, mobile and desktop applications. Senior Esri development staff will be presenting so you’ll get a chance to see what’s coming next. Registration information will be available soon but mark your calendar now and plan to join us in Europe.

Posted in Developer | Tagged , , , , , , , , , , , , , , , , , | Leave a comment

ArcGIS Runtime SDK 1.0 for WPF Release

We are happy to announce the release of the ArcGIS Runtime SDK 1.0 for WPF.  A huge thanks to our users for great feedback given during Beta and Pre-Release stages that helped to shape this Final Release.

So, what is the ArcGIS Runtime SDK 1.0 for WPF?

The ArcGIS Runtime SDK 1.0 for WPF enables developers to build rich, highly functional GIS applications that take full advantage of the Windows Presentation Foundation (WPF) platform, yet the applications can be lightweight and have a small footprint.  Version 3.0 of the ArcGIS API for WPF has been renamed to the ArcGIS Runtime SDK 1.0 for WPF and includes new functionality to support local mapping, geocoding and geoprocessing via the runtime local server and a new accelerated display.

Continue reading

Posted in Developer | Tagged , , , , , | 2 Comments

ArcGIS Runtime SDK 1.0 Now Available

The new ArcGIS Runtime SDK for WPF and Java on Windows is now available to all Esri Developer Network (EDN) subscribers. This new SDK provides the development tools and resources that allow you to create focused mapping applications. The SDK enables you to integrate both online and local maps, locators, and geoprocessing models to create rich, highly functional GIS applications that take full advantage of the Java platform for Desktop or Microsoft’s WPF technology.

Continue reading

Posted in Developer | Tagged , , , , , , , | Leave a comment

Implementing a feature template dialog box in your code

In ArcGIS 10, feature templates define all the information required to create a feature, such as the target layer and the attributes the new feature will receive. Most of the time, you interact with feature templates on the Create Features window. However, some editing operations present a dialog box containing templates that you can choose for the output for that particular feature creation workflow. For example, the Select Feature Template dialog box used with the Editor menu > Buffer command allows you to set the feature template that will be used to create the new buffer feature. The list of templates is filtered to show only editable and visible polygon or line layers in the map; feature templates for other templates are hidden and cannot be used for the buffer output.

If you are developing a custom command or tool that requires the user to specify a feature template for the output of your workflow, you have two options for working with or presenting feature templates in the map. You can require the user to select a template from the Create Features window or you can implement a feature template dialog box that works similar to the Buffer command. Often, implementing your own feature template dialog box is the better option, as you can ensure the user has specified a template that meets the criteria of your customization. For example, you may only want the user to choose from templates from certain layers or those that are of a particular geometry type.

If you decide to create your own template dialog box for a customization, you can start by downloading a sample that Esri has created and shared in the Editing Labs group on ArcGIS.com. This sample is a Visual Studio 2010 project written in C# that creates an add-in containing simple dialog boxes to display templates. The sample was modeled after the template dialog box from the Buffer command and contains the same controls and considerations for displaying feature templates. You can use some or all of the functionality from this sample for your own customization. It is important to note that the dialog box can only display existing templates; you must create, delete, and manage templates for layers as usual through the Organize Feature Templates window.

Using the Template Dialog Sample command
The sample creates an add-in command that provides a similar chain of dialog boxes as Buffer: clicking the command opens a dialog box containing a button that opens another dialog box with a list of feature templates. The command is called Template Dialog Sample, which is TemplateAppButtton.cs in the Visual Studio project. To explore the sample’s functionality in ArcMap, compile the project or install the add-in that accompanies the download. Then, drag the Template Dialog Sample command from the Customize dialog box > Commands tab > Editing Labs category and place the button onto any toolbar. The command is only enabled when you are in an edit session.

Click the Template Dialog Sample button on the toolbar to which you added it to display the template application form (TemplateAppForm.cs). Click the Template button on the Template App Form dialog box to open the Template Picker Form (TemplatePickerForm.cs). Similar to the Select Feature Template dialog box opened from the Buffer command’s dialog box, the Template Picker Form allows you to choose a template and search for templates by name, tag, and layer.

In this sample, the Template Picker Form displays feature templates from all visible point, line, and polygon layers in the current editing workspace. If you want to enable filtering by geometry type, for example, you can modify the sample code through an enumeration in TemplateAppForm.cs when calling the TemplatePickerForm.

Most of the internal work in the sample occurs in the TemplatePickerForm class. This class contains a Visual Studio ListView control to display the templates as ListViewItems arranged into ListViewGroups that represent the layers. Selecting a template sets the _currentTemplate variable back on the add-in button, which can be used to set the current Editor template target on IEditor3.CurrentTemplate. The template can then be used to help you create new features as described in the Working with templates section in the Using feature templates help topic.

Content provided by Sean (Editing Team)

Posted in Developer, Editing | Tagged , , , , , , , , , | Comments Off

Incorporating snapping into custom tools

If you are writing a custom tool in ArcMap to select features or create geometry a certain way, then you’ll often need to make it snap to existing features on the map. In the past, snapping was restricted to editing and was somewhat cumbersome for developers to implement. However, ArcGIS 10 provides the ArcGIS Snapping Environment, which offers users a simplified experience in ArcGIS Desktop or ArcGIS Engine and gives developers a straightforward application programming interface (API) to enable snapping in custom tools. This blog entry introduces you to the snapping API and provides sample code that demonstrates how you can incorporate snapping into your own tools.

To implement snapping in a tool, there are two options available depending upon if the tool will be used while editing. If your tool will be used both inside and outside an edit session, you can implement snapping directly by going through the snapping extension. If your tool will be used exclusively within an edit session, you can access snapping indirectly through the Editor object, which takes care of most of the initialization work for you.

Implementing snapping via the extension
First, I am going to show you how to access the snapping environment directly using its extension. This is applicable for a tool that can be used both inside and outside of an edit session. To demonstrate this, I develop a simple tool that reports the x,y location of a mouse click at its snapped location.

I start by creating a tool add-in by following the directions from the SDK help topic, Building add-ins for ArcGIS Desktop. Then, with the help of Working with the ArcGIS snapping environment, I add the code required to enable snapping in the tool. After adding a reference to the ESRI Controls assembly, I can access and initialize the snapping environment in my tool’s Click event. For add-in tools, this event is the OnActivate method.

Next, I can use the cursor location returned from the tools MouseMove event and determine if it actually snaps to anything. If it does, then I update a variable with the snapped position.

The complete code sample is shown below.

using ESRI.ArcGIS.Controls;

using
ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geometry;

namespace
ToolWithSnapping

{


public
class
ShowMapCoordinates
: ESRI.ArcGIS.Desktop.AddIns.Tool


{



ISnappingEnvironment m_SnappingEnv;



IPointSnapper m_Snapper;



ISnappingFeedback m_SnappingFeedback;



IPoint m_Position;


public ShowMapCoordinates()


{


}


Protected override
void OnActivate()


{



//Get the snap environment and initialize the feedback



UID snapUID = new
UID();



snapUID.Value =
“{E07B4C52-C894-4558-B8D4-D4050018D1DA}”
;



m_SnappingEnv = ArcMap.Application.



FindExtensionByCLSID(snapUID) as
ISnappingEnvironment;


m_Snapper =
m_SnappingEnv.PointSnapper;



m_SnappingFeedback = new
SnappingFeedbackClass();



m_SnappingFeedback.Initialize(ArcMap.Application,
m_SnappingEnv, true);


}


protected override
void OnMouseMove(MouseEventArgs
arg)


{



//Get the current position in map units



//This is the cursor location before snapping


m_Position
= ArcMap.Document.ActiveView.



ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y);


ISnappingResult snapResult =
null;


//Try to snap the current position


snapResult
= m_Snapper.Snap(m_Position);


m_SnappingFeedback.Update(snapResult, 0);



if (snapResult != null)



//Snapping occurred



//Set the current position to the snapped location



m_Position = snapResult.Location;


}


protected override
void OnMouseDown(MouseEventArgs
arg)


{



System.Windows.Forms.MessageBox.Show(“Map units:rnX: “



+ m_Position.X.ToString() + “rnY: “ +
m_Position.Y.ToString());


}


protected override
void OnRefresh(int
hDC)


{



if (m_SnappingFeedback !=
null)



m_SnappingFeedback.Refresh(hDC);


}


}

}

In my code, the variable m_Position holds the snapped position of the cursor. If my tool were creating geometry or updating screen feedback (such as with INewLineFeedback), then I would use the m_Position variable rather than the mouse position (MouseEventArgs) as the update point.

Implementing snapping in an edit session
As I mentioned before, if you are developing a tool that will be used exclusively in an edit session, implement snapping with the help of the Editor object. The main advantage of doing this is that the Editor will work with either the ArcGIS Snapping Environment or editing classic snapping, but only in an edit session, of course. Classic snapping refers to the snapping functionality that was available during an edit session in ArcGIS 9 and allows you to set up snapping in a more complex manner on a layer-by-layer basis. The ArcGIS Engine edit sketch and any custom tools that derive it are limited to the classic snapping environment.

Generally speaking, there two types of Editor tools you can build: those that use the edit sketch and those that don’t. You would typically use the edit sketch in a tool if you wanted to use the sketch to help you create some geometry or feedback on the screen. You can then take that geometry and use it as the basis to create a feature with it or use it for selections. If you are creating an ArcMap tool that uses the edit sketch, you don’t have to worry about snapping at all since the Editor handles it entirely for you. The edit sketch also comes with its own context menu (the one used by the Polygon or Line construction tools) and shape constructors, so it’s convenient for developers. In ArcGIS 10, you can only build a tool that uses the edit sketch through COM, which creates a .dll.

If you are not using the edit sketch in your tool, which is most likely because it doesn’t provide the geometry you need, then there is a bit more work involved because you have to create your own geometry using mouse clicks and implement snapping yourself. This type of tool can be made into an add-in or COM .dll.

For the sample code, I’ll use the same example of an add-in tool that reports the x,y position of the snapped location. In this case, I only have to reference the Editor and not the Controls assembly to enable snapping.

using
System;

using
ESRI.ArcGIS.Editor;

using
ESRI.ArcGIS.Geometry;

namespace
ToolWithSnappingES

{


public
class
ShowMapCoordinatesES
: ESRI.ArcGIS.Desktop.AddIns.Tool


{



IEditor m_Editor =
null
;



IPoint m_Position =
null
;


public ShowMapCoordinatesES()


{


m_Editor =
ArcMap.Application.FindExtensionByName(“esriEditor.Editor”)
as
IEditor;


}



protected override
bool OnDeactivate()


{



if (m_Position != null)



m_Editor.InvertAgent(m_Position, 0);


m_Position
= null;



return true;


}



protected override
void OnMouseMove(MouseEventArgs
arg)


{



if (m_Position != null)



m_Editor.InvertAgent(m_Position, 0);


m_Position
= m_Editor.Display.DisplayTransformation.ToMapPoint(arg.X, arg.Y);



//Get the snap environment from the editor



ISnapEnvironment se = m_Editor
as ISnapEnvironment;



Boolean snapped = se.SnapPoint(m_Position);



m_Editor.InvertAgent(m_Position, 0);


}



protected override
void OnMouseDown(MouseEventArgs
arg)


{



System.Windows.Forms.MessageBox.Show(“Map units:rnX: “



+ m_Position.X.ToString() + “rnY: “ +
m_Position.Y.ToString());


}



protected override
void OnRefresh(int
hDC)


{



if (m_Position != null)



m_Editor.InvertAgent(m_Position, hDC);


}



protected override
void OnUpdate()


{


Enabled =
(m_Editor.EditState == esriEditState.esriStateEditing);


}


}

}

The code is very similar to the extension example, where the variable m_Position holds the snapped position and would be used to create geometry or update feedback. In this case, I have to be careful with refreshing the feedback. The code calls InvertAgent, which essentially paints the screen with the feedback of a blue dot. To erase the feedback, I need to call InvertAgent again. If I get out of sync, I can be left with feedback graphics on the screen that will not go away until I refresh the screen. Normally, though, if you are working with ArcGIS Snapping, the environment takes care of this for you.

For more information
To learn more about developing with the ArcGIS Snapping environment, see Snapping in ArcGIS in the ArcGIS Developer Help.

To view some example editing tools that incorporate snapping, see the Editing Labs group on ArcGIS.com (make sure to filter by Show: All Content at the top of the page).

Post content from Sean (Editing Team)

Posted in Developer, Editing | Tagged , , , , , , , , , , | Comments Off

ArcGIS Mobile SDK and Visual Studio Support Explained!

We have received several questions regarding support for versions of Visual Studio when developing applications and extensions using the ArcGIS Mobile SDK and we would like to address the 2 most common questions in this article.

Can I use Visual Studio 2010 to develop Windows Mobile/Windows Embedded Handheld Applications?

Unfortunately No. Microsoft only supports Windows Phone OS 7.0 and higher with Visual Studio 2010. See the following article from MSDN (http://msdn.microsoft.com/en-us/library/sa69he4t.aspx).

What version of the Compact Framework should I use (2.0 or 3.5)?

ArcGIS Mobile is compiled using .Net CF 2.0. Most Windows Mobile devices in the market today are running Windows Mobile 6.1 or 6.5. These devices include .Net CF 2.0. If you build applications that depend upon CF 3.5 then you will need to deploy 3.5 as a part of your install. So unless there is a feature of 3.5 that you must use, we recommend using version 2.0.

Can I use Visual Studio 2008 with Compact Framework 3.5? 

Officially, the answer is YES. However there is some manual work required for you to get the ArcGIS Mobile libraries integrated into Visual Studio…

The problem you will face is that the ArcGIS Mobile components will not appear inside of the Toolbox. The reason for this is that Microsoft does not load .Net CF 2.0 libraries into a CF 3.5 toolbox (even though 2.0 libraries are fully compatible with a 3.5 framework).

You can work around this issue in the following way:

1) Create a CF 2.0 project and design the form using the 2.0 toolbox elements.

 

2) Upgrade your project to a CF 3.5 project. Note that you will still get the same elements in your form but you will no longer have ArcGIS Mobile toolbox items.

 

Alternately, you can directly create your forms in 3.5 by writing the code behind and not using the Toolbox. This is what we do with the ArcGIS Mobile application in fact.

1) Open the Form.Designer.cs file

partial class Form1

  {

    /// <summary>

    /// Required designer variable.

    /// </summary>

    private
System.ComponentModel.IContainer components
= null;

    private
System.Windows.Forms.MainMenu mainMenu1;

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param
name=”disposing”>
true if managed
resources should be disposed; otherwise, false.
</param>

    protected
override void
Dispose(bool disposing)

    {

      if (disposing && (components != null))

      {

       
components.Dispose();

      }

      base.Dispose(disposing);

    }

 

    #region Windows Form Designer
generated code

 

    /// <summary>

    /// Required method for Designer support – do not modify

    /// the contents of this method with the code editor.

    /// </summary>

    private
void InitializeComponent()

    {

      this.mainMenu1 = new
System.Windows.Forms.MainMenu();

      this.Menu = this.mainMenu1;

      this.components = new
System.ComponentModel.Container();

      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;

      this.Text = “Form1″;

      this.AutoScroll = true;

    }

 

    #endregion

 
}

2) Add references to your CF 3.5 project by browsing for our CF 2.0 library 

 

3) Add the necessary new members.

Normal
0

false
false
false

EN-US
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:”";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:”Calibri”,”sans-serif”;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:”Times New Roman”;
mso-bidi-theme-font:minor-bidi;}

partial class Form1

  {

    /// <summary>

    /// Required designer variable.

    /// </summary>

    private
System.ComponentModel.IContainer components
= null;

    private
System.Windows.Forms.MainMenu mainMenu1;

 

    /// <summary>

   
/// Esri components

   
/// </summary>

   
private ESRI.ArcGIS.Mobile.WinForms.Map map1;

    private ESRI.ArcGIS.Mobile.FeatureCaching.MobileCache
mobileCache1;

4) Create and Initialize members in InitializeComponent.

Normal
0

false
false
false

EN-US
X-NONE
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:”";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:”Times New Roman”,”serif”;}

private void
InitializeComponent()

    {

      this.mainMenu1 = new
System.Windows.Forms.MainMenu();

      this.Menu = this.mainMenu1;

      this.components = new
System.ComponentModel.Container();

      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;

      this.Text = “Form1″;

      this.AutoScroll = true;

 

      this.SuspendLayout();

 

     
// Map

     
this.map1 = new
ESRI.ArcGIS.Mobile.WinForms.Map();

     
this.map1.Location = new
System.Drawing.Point(23, 29);

     
this.map1.Name = “map1″;

     
this.map1.Size = new
System.Drawing.Size(200, 200);

     
this.map1.TabIndex = 0;

     
this.map1.Text = “map1″;

     
this.Controls.Add(this.map1);

 

     
// Cache

     
this.mobileCache1 = new
ESRI.ArcGIS.Mobile.FeatureCaching.MobileCache(this.components);

 

     
this.ResumeLayout(false);

    }

 

5) You should get the following result.

 

Given that the time you will spend designing the form is negligible, we recommend the later approach for your 3.5 development.  

 

 

Posted in Mobile | Tagged , , , , , , , , | Leave a comment

Moving to Add-ins (Recycling VBA)

In the Spring edition of ArcUser there is a nice article by Craig Gallant (LJB Inc) on converting existing projects to ArcGIS Add-ins.

Here how’s the article starts…

You might ask this after installing ArcGIS 10. With the release of ArcMap 10, Visual Basic for Applications (VBA) is on the way out. As the online help article “Migrating VBA customizations to ArcGIS 10″ explains, “VBA no longer provides the best toolset for customizing ArcGIS and is not included in the default installation.”

At ArcGIS 10, there are two new ways to customize in ArcGIS 10: Python and the new ArcGIS Desktop Add-in. [Add-ins are a new way to customize and extend ArcGIS 10. They are authored in .NET or Java and Extensible Markup Language (XML). They provide a declaratively based framework for creating a collection of customizations that can be conveniently packaged in a single compressed file that is easily shared. Add-ins do not require installation programs or Component Object Model (COM) registration.] Both options have advantages and disadvantages. You need to pick the option that best suits your application. This article shows how, with a little refactoring, existing VBA code can quickly be converted to an ArcGIS Desktop Add-in.

for more see ArcUser Online

 

Posted in Developer | Tagged , , , , , , , , , , , | Leave a comment

Visual Studio Support

The official Deprecation Plan for ArcGIS 10.0 and 10.1 document has been updated and there is a new announcement I want all Desktop and Engine developers to be aware of.

Esri will only support Visual Studio 2010 for ArcObjects .NET development at ArcGIS 10.1

There will not be a ArcObjects SDK for .NET and Visual Studio 2008. Hopefully this won’t be an issue for any .NET developers out there.  ArcGIS 10.0 today supports both 2008 and 2010 but at 10.1 we’ll only be able to support Visual Studio 2010.

 

Posted in Developer | Tagged , , , , , , , , | 11 Comments