It is very easy to get started with the MapFlashViewer Framework in the ASP .NET Implementation (C#) I talked about in this post.
This implementation was written using ActiveX Connector for ArcIMS 9.0 and C# MapScript for MapServer 4.10.0. You can easily adapt the code for previous or next versions.
Open the solution
You will find several files in the C# ASP .NET project included with the solution you downloaded:
- A simple default.aspx web form with the MapControl user control over it
- A form test.aspx for debugging purpose (you don’t need unleass you are in troubles)
- the Controller (responsable for translating XML request/response to the Flash UI): the xml.aspx page
- the FlashViewer.ImageMapServer namespace with the classes needed for the .NET implementation (particullary impourtant are MapServerFactory.cs, MapServer.cs and ArcIMS.cs)
- the MapControl user control
You should easily follow how it works the implementation, for simplicity you can take a look at the UML Class Diagram (that should be the same for each environment implementation):
The code is extensively commented so you should be able to understand how it works in a short time. Remember that the MapServerFactory is an abstract class for the Abstract Factory Design
Pattern implementation. The specific code for the various internet map server are in the concrete leaf class derived from the MapServerFactory: at this time you will find an implementation for MapServer and for ArcIMS (maybe some more in the future).
Add the MapControl on any form
You can set the default.aspx form as the startup form of your project or you can add another web form and drag the MapControl user control on this form.
Edit web.config with your settings
Next you have to edit the web.config file with your settings.
This is the web.config portion you need to edit:
<configSections> <section name="General" type="System.Configuration.SingleTagSectionHandler,system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <section name="ArcIMS" type="System.Configuration.SingleTagSectionHandler,system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <section name="MapServer" type="System.Configuration.SingleTagSectionHandler,system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </configSections> <!-- general parameters (valid for each map server type) - mapServerType: should be setted to ARCIMS or MAPSERVER (in future could be other implementations for other MapServer software) - mapWidth,mapHeight: width and height of FlashViewer map in pixels --> <General mapServerType="MAPSERVER" mapWidth="700" mapHeight="500" /> <!-- fill this section with the right parameters only if mapServerType=ArcIMS - server: ArcIMS server name - port: ArcIMS server port (generally 5300) - mapservice: name of mapservice --> <ArcIMS server="asadev" port="5300" mapservice="flashviewer" /> <!-- fill this section with the right parameters only if mapServerType=MapServer - mapFile: full name of mapfile --> <MapServer mapFile="C:\training\mapServerTutorial\data\csharptutorial.map" />
In the General tag you will type the mapServerType (ARCIMS or MAPSERVER) and the width and eight of the map in pixels.
If you are using ArcIMS you will need to type the attributes for the ArcIMS tag (server, port, mapservice).
If you are using MapServer you will need to type the attributes for the MapServer tag (just the full name of mapfile)
Compile the solution for your internet map server
Now you can compile the solution.
If you want to use the framework with ArcIMS you will need to edit the Conditional Compilation Constants (under Build in project properties) and remove the IncludeMapServer constant.
If you want to use the framework with MapServer you will need to edit the Conditional Compilation Constants (under Build in project properties) and remove the IncludeArcIMS constant.
Run the solution
You can now run your project.











comment je peux avoir une version démo