日期:2014-05-16  浏览次数:20456 次

NET下基于OO4O,FME,ODP.NET的Oracle Spatial空间数据读取操作

NET下基于OO4O,FME,ODP.NET的Oracle Spatial空间数据读取操作



using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using Safe.FMEObjects;
using System.Collections.Specialized;
using System.Xml;
using Oracle.DataAccess.Client;
using OracleInProcServer;


namespace CSharpReader_Writer
{
    
    class Program
    {
        //
        static void Main(string[] args)
        {
            //ReadOracleSpatial();            
            //WriteMapInfo();


            oo4o();


            string t = Console.ReadLine();


        }


        //Write MapInfo
        static void WriteMapInfo()
        {
            string appPath = Assembly.GetExecutingAssembly().Location;
            int index = appPath.LastIndexOf("\\", appPath.Length - 1);
            string appFolder = appPath.Substring(0, index);
            string appName = appPath.Substring(index + 1);


            index = appName.LastIndexOf(".", appName.Length - 1);
            appName = appName.Substring(0, index);


            const string releaseFolderName = "bin\\Release";
            const string debugFolderName = "bin\\Debug";


            index = appFolder.Length - releaseFolderName.Length;
            if (String.Equals(appFolder.Substring(index), releaseFolderName))
            {
                appFolder = appFolder.Substring(0, index);
            }
            else
            {
                index = appFolder.Length - debugFolderName.Length;
                if (String.Equals(appFolder.Substring(index), debugFolderName))
                {
                    appFolder = appFolder.Substring(0, index);
                }
            }
            string logFileName = appName + ".log";


            // datasetName should be one of MIF or MAPINFO or SDE30 or GML2 or DWG or ORACLE8I
            string datasetName = "SHAPE";// "MAPINFO";// args[0];
            //日志文件路径
            string logFilePath = appFolder + logFileName;
            //数据集路径
            string datasetFilePath = appFolder + datasetName;
            //
            //Create the session object
            IFMEOSession fmeSession = FMEObjects.CreateSession();
            //初始化the session
    &