drawmap.cs
来自「Welcome to MS4W, the no fuss installer f」· CS 代码 · 共 52 行
CS
52 行
using System;
/**
* <p>Title: Mapscript shape dump example.</p>
* <p>Description: A C# based mapscript example to create an image given a mapfile.</p>
* @author Yew K Choo ykchoo@geozervice.com
* @version 1.0
*/
/// <summary>
/// A C# based mapscript mapscript example to create an image given a mapfile.
/// </summary>
class DrawMap
{
public static void usage()
{
Console.WriteLine("usage: DrawMap {mapfile} {outfile}");
System.Environment.Exit(-1);
}
public static void Main(string[] args)
{
if (args.Length != 2) usage();
mapObj m_obj = new mapObj(args[0]);
Console.WriteLine ("# Map layers " + m_obj.numlayers + "; Map name = " + m_obj.name);
for (int i=0; i<m_obj.numlayers; i++)
{
Console.WriteLine("Layer [" + i + "] name: " + m_obj.getLayer(i).name);
}
imageObj i_obj = m_obj.draw();
Console.WriteLine("Image URL = " + i_obj.imageurl + "; Image path = " + i_obj.imagepath);
Console.WriteLine("Image height = " + i_obj.height + "; width = " + i_obj.width);
try
{
i_obj.save(args[1],m_obj);
}
catch (Exception ex)
{
Console.WriteLine( "\nMessage ---\n{0}", ex.Message );
Console.WriteLine(
"\nHelpLink ---\n{0}", ex.HelpLink );
Console.WriteLine( "\nSource ---\n{0}", ex.Source );
Console.WriteLine(
"\nStackTrace ---\n{0}", ex.StackTrace );
Console.WriteLine(
"\nTargetSite ---\n{0}", ex.TargetSite ); }
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?