📄 sdeservice.java
字号:
package com.esri.aims.mtier.dx;
import com.esri.sde.sdk.client.*;
import java.util.*;
import java.io.*;
public class SdeService {
SeConnection sdeConn=null;
public SdeService() {
}
/**
* 带参数的构造函数
* @param server 主机名
* @param instance 端口号
* @param database 数据库名
* @param user 用户
* @param password 密码
* @throws SeException
*/
public SdeService(String server,int instance,String database,String user,String password) throws SeException,Exception{
initConn(server,instance,database,user,password);
}
/**
* 初始化连接
* @param server 主机名
* @param instance 端口号
* @param database 数据库名
* @param user 用户
* @param password 密码
* @throws SeException
*/
public void initConn(String server,int instance,String database,String user,String password) throws SeException,Exception{
try{
sdeConn=new SeConnection(server,instance,database,user,password);
}catch(SeException ex){
throw new Exception(ex.getSeError().getErrDesc());
}
}
//************************************************************************************//
/* registration and make version */
//************************************************************************************//
/**
* 判断是否注册
* @param tableName String
* @throws SeException
* @return boolean
*/
public boolean isRegistration(String tableName) throws SeException,Exception{
boolean isReg=false;
return isReg;
}
/**
* 注册
* @param tableName String
* @throws SeException
*/
public void makeRegistration(String tableName) throws SeException,Exception{
}
/**
* 判断是否支持多版本
* @param tableName String
* @throws SeException
* @return boolean
*/
public boolean isMultiVersion(String tableName) throws SeException,Exception{
boolean isMultiVersion=false;
return isMultiVersion;
}
/**
* 多版本
* @param tableName String
* @param isMulti boolean
* @throws SeException
*/
public void makeMultiVersion(String tableName,boolean isMulti) throws SeException,Exception{
}
/**
* 创建新版本
* @param versionName String
* @throws SeException
* @return SeVersion
*/
public SeVersion createNewVersion(String versionName) throws SeException,Exception{
SeVersion newVersion = null;
return newVersion;
}
/**
* 创建子状态
* @param parentState SeState
* @throws SeException
* @return SeState
*/
public SeState createChildState(SeState parentState) throws SeException,Exception{
SeState child = null;
return child;
}
//************************************************************************************//
/* create table and layer */
//************************************************************************************//
/**
* 获取当前操作图层
* @param tableName 表名
* @throws SeException
* @return SeLayer
*/
public SeLayer getActiveLayer(String tableName) throws SeException,Exception{
SeLayer layer = null;
return layer;
}
/**
* 设置表结构
* @param colNames String[],字段名
* @param colTypes int[],字段类型 {1-int16;2-int32;3-float32;4-float64;5-string;6-blob;7-date}
* @throws SeException
* @throws Exception
* @return SeColumnDefinition[]
*/
public SeColumnDefinition[] setColumnDefinition(String[] colNames,int[] colTypes) throws
SeException,Exception {
SeColumnDefinition[] colDefs = null;
return colDefs;
}
/**
* 创建图层及属性表
* @param tableName 表名
* @param type 图层类型 -> "point"、"line"、"polygon"
* @param colDefs SeColumnDefinition[]
* @throws SeException
* @throws IOException
* @return SeLayer
*/
public SeLayer createTable(String tableName,String type,SeColumnDefinition[] colDefs) throws SeException,IOException,Exception{
SeLayer layer = null;
return layer;
}
/**
* 删除图层及属性表
* @param tableName 表名
* @throws SeException
*/
public void deleteTable(String tableName) throws SeException,Exception{
}
/**
* 关闭连接
* @throws SeException
*/
public void closeSdeConn() throws SeException {
if(!sdeConn.isClosed())
sdeConn.close();
}
//************************************************************************//
/* insert delete update query */
//************************************************************************//
/**
* 创建空间要素
* @param pts String[],点坐标
* @param shapeType Shape类型
* @param coordRef 参考坐标
* @throws SeException
* @return SeShape
*/
public SeShape createShape(String[] pts, int shapeType, SeCoordinateReference coordRef) throws SeException,Exception {
SeShape shape = null;
return shape;
}
/**
* 设置要素属性集
* @param row SeRow
* @param rowCells Vector
* @throws SeException
*/
protected void setRowCells(SeRow row,Vector rowCells) throws SeException,Exception{
}
/**
* 插入空间数据
* @param tableName String
* @param rowCells Vector
* @throws SeException
* @throws Exception
*/
public void insertSpatialData(String tableName,Vector rowCells) throws SeException,Exception{
SeLayer layer=getActiveLayer(tableName);
if(layer==null || rowCells==null) return;
}
/**
* 更新空间数据
* @param tableName String
* @param rowCells Vector
* @param whereClause String
* @throws SeException
* @throws Exception
*/
public void updateSpatialData(String tableName, Vector rowCells, String whereClause) throws SeException,Exception{
SeLayer layer=getActiveLayer(tableName);
if(layer==null || rowCells==null) return;
}
/**
* 删除空间数据
* @param tableName String
* @param whereClause String
* @throws SeException
*/
public void deleteSpatialData(String tableName,String whereClause) throws SeException,Exception{
SeLayer layer=getActiveLayer(tableName);
if(layer==null) return;
}
/**
* 获取属性查询数据
* @param tableName String
* @param whereClause String
* @throws SeException
* @return List
*/
public List fetchQueryData(String tableName,String whereClause) throws SeException,Exception {
SeLayer layer=getActiveLayer(tableName);
if(layer==null) return null;
Vector queryRows=new Vector();
return queryRows;
}
/**
* 获取空间查询数据
* @param tableName String
* @param shape SeShape[]
* @param method int
* @throws SeException
* @return List
*/
public List fetchSpatialQueryData(String tableName, SeShape[] shape,int method) throws
SeException,Exception {
SeLayer layer = getActiveLayer(tableName);
if(layer==null) return null;
Vector queryRows = new Vector();
return queryRows;
}
public void readQueryRows(SeRow row) throws SeException,Exception {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -