using ExportMap.db;
using ExportMap.Models;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
namespace ExportMap.cs
{
public class SGUtils
{
///
/// Mpt目录
///
public static string MptPath
{
get
{
return ConfigurationManager.AppSettings["mptFolder"];
}
}
///
/// 3DML目录
///
public static string D3mlFolder
{
get
{
return ConfigurationManager.AppSettings["3dmlFolder"];
}
}
///
/// 廊坊数据目录
///
public static string LFData
{
get
{
return ConfigurationManager.AppSettings["lfData"];
}
}
///
/// SG的DB库
///
public static string SGDB
{
get
{
return ConfigurationManager.AppSettings["sgDB"];
}
}
///
/// 发布数据
///
/// XYZ参数
/// 行数
public static int Release(XYZArgs args)
{
List list = XYZUtils.selectMetas(args.ids, "and type in ('mpt', '3dml')");
if (null == list || list.Count == 0) return 0;
int maxId = GetMaxId();
List items = SelectItems(maxId);
if (null == items || items.Count == 0) return 0;
return 0;
}
///
/// 获取最大ID值
///
public static int GetMaxId()
{
Object obj = SQLiteHelper.ExecuteScalar("select max(id) from SpatialItems");
return null == obj ? 0 : Convert.ToInt32(obj);
}
///
/// 查询SG数据项
///
/// 最大ID值
/// SG数据项
public static List SelectItems(int maxId)
{
string sql = string.Format("select id, Name, RelativePath, LayerName, DataSourceId, Description from SpatialItems where id > {0} order by id desc", maxId);
DataTable dt = SQLiteHelper.GetDataTable(sql);
List list = ModelHandler.FillModel(dt);
return list;
}
}
}