本文整理汇总了Java中com.esri.arcgis.geodatabase.IRow类的典型用法代码示例。如果您正苦于以下问题:Java IRow类的具体用法?Java IRow怎么用?Java IRow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IRow类属于com.esri.arcgis.geodatabase包,在下文中一共展示了IRow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isProcedure
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
@Override
public boolean isProcedure(String procedureResourceID) throws AutomationException, IOException {
ICursor cursor = DatabaseUtils.evaluateQuery(Table.PROCEDURE,
AccessGDBImpl.concatTableAndField(Table.PROCEDURE, SubField.PROCEDURE_RESOURCE) + " = '" + procedureResourceID + "'",
AccessGDBImpl.concatTableAndField(Table.PROCEDURE, SubField.PROCEDURE_RESOURCE),
gdb);
IRow row;
while ((row = cursor.nextRow()) != null) {
String procedureIdFromDB = row.getValue(0).toString();
if (procedureIdFromDB != null && procedureIdFromDB.equalsIgnoreCase(procedureResourceID)) {
return true;
}
}
return false;
}
示例2: analyzeTable
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
/**
* @throws IOException
* @throws AutomationException
*
*/
public JSONObject analyzeTable (String tableName, String primaryKeyColumn) throws AutomationException, IOException {
JSONObject json = new JSONObject();
try {
ICursor cursor = DatabaseUtils.evaluateQuery(tableName, "", "COUNT(" + primaryKeyColumn + ")",
workspace);
json.append("Reading count of table:", tableName);
IRow row;
if ((row = cursor.nextRow()) != null) {
Object count = row.getValue(0);
String countAsString = count.toString();
json.append("Table count:", countAsString);
}
} catch (Exception e) {
LOGGER.severe(e.getLocalizedMessage(), e);
throw new IOException(e);
}
return json;
}
示例3: analyzeProcedureTable
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
/**
* @throws IOException
* @throws AutomationException
*
*/
public JSONObject analyzeProcedureTable () throws AutomationException, IOException {
JSONObject json = new JSONObject();
json.append("This function: ", "...checks the availability of a table as specified in the properties of this SOE (configure in ArcGIS Server Manager).");
json.append("This function: ", "...and presents the count of rows contained in that table.");
try {
ICursor cursor = DatabaseUtils.evaluateQuery(soe.getTable(), "", "COUNT(" + soe.getTablePkField() + ")", workspace);
json.append("Reading count of table:", soe.getTable());
IRow row;
if ((row = cursor.nextRow()) != null) {
Object count = row.getValue(0);
String countAsString = count.toString();
json.append("Table count:", countAsString);
}
} catch (Exception e) {
LOGGER.severe(e.getLocalizedMessage(), e);
json.append("ERROR:", "while trying to read table '" + soe.getTable() + "' with specified primary key '" + soe.getTablePkField() + "'");
}
return json;
}
示例4: createObservationsFromCursor
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
private Map<String, MultiValueObservation> createObservationsFromCursor(
ICursor cursor, List<String> fields) throws IOException {
// convert cursor entries to abstract observations
// map that associates an observation-ID with an observation:
Map<String, MultiValueObservation> idObsMap = new HashMap<String, MultiValueObservation>();
IRow row;
while ((row = cursor.nextRow()) != null) {
String obsID = row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.OBSERVATION, SubField.OBSERVATION_ID))).toString();
if (!idObsMap.containsKey(obsID)) {
MultiValueObservation multiValObs = createMultiValueObservation(row, fields);
multiValObs.getResult().addResultValue(createResultValue(row, fields));
idObsMap.put(obsID, multiValObs);
} else {
idObsMap.get(obsID).getResult().addResultValue(createResultValue(row, fields));
}
}
return idObsMap;
}
示例5: isNetwork
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
@Override
public boolean isNetwork(String procedureID) throws AutomationException, IOException {
ICursor cursor = DatabaseUtils.evaluateQuery(Table.NETWORK,
AccessGDBImpl.concatTableAndField(Table.NETWORK, SubField.NETWORK_ID) + " = '" + procedureID + "'",
AccessGDBImpl.concatTableAndField(Table.NETWORK, SubField.NETWORK_ID),
gdb);
IRow row;
while ((row = cursor.nextRow()) != null) {
String networkID = row.getValue(0).toString();
if (networkID != null && networkID.equalsIgnoreCase(procedureID)) {
return true;
}
}
return false;
}
示例6: modify
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
public void modify(Object element, String property, Object value) {
if(value.toString().equals("")||this.oid<0)return;
try {
edit.startEditing(true);
edit.startEditOperation();
TableItem item=(TableItem)element;
String[] column = (String[]) item.getData();
int col=new Integer(property).intValue();
column[col]=value.toString();
QueryFilter qf=new QueryFilter();
qf.setWhereClause("FID="+column[oid]);
ICursor cursor=table.update(qf,false);
IRow row=cursor.nextRow();
row.setValue(col,value);
row.store();
edit.stopEditOperation();
edit.stopEditing(true);
tv.update(item.getData(),null);
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: modifyCell
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
/**
* @param frId The index of given revise field
* @param cursor The cursor of selectionSet of a pair
* @param ratio Revise value
* @throws Exception
* @desire getSelection
* @usedfor modify the value of cells in selectionSet
*/
private void modifyCell(int frId,ICursor cursor,double ratio)throws Exception{
int fwId=cursor.findField(fieldWrite);
IRow row = cursor.nextRow();
DecimalFormat format=new DecimalFormat("#.00");
while(row!=null){
double readValue=Double.parseDouble(row.getValue(fwId).toString());
String formatStr=format.format(readValue*ratio);
Double writeValue=new Double(formatStr);
System.out.println("modify before:"+readValue+" after:"+writeValue);
row.setValue(fwId,writeValue);
row.store();
// cursor.updateRow(row);
row=cursor.nextRow();
}
}
示例8: createResultValue
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
/**
*
* @param row
* @param fields
* @return
* @throws IOException
* @throws AutomationException
*/
protected MeasureResult createResultValue(IRow row,
List<String> fields) throws AutomationException, IOException
{
// start time
Date startDate = (Date) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.VALUE, SubField.VALUE_DATETIME_BEGIN)));
ITimePosition startTimePos = TimeConverter.createTimeFromDate(startDate, null);
// end time
Date endDate = (Date) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.VALUE, SubField.VALUE_DATETIME_END)));
ITimePosition endTimePos = TimeConverter.createTimeFromDate(endDate, null);
// validity
String validity = (String) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.VALIDITY, SubField.VALIDITY_NOTATION)));
if (validity == null) {
validity = Constants.NULL_VALUE;
}
// verification
String verification = (String) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.VERIFICATION, SubField.VERIFICATION_NOTATION)));
if (verification == null) {
verification = Constants.NULL_VALUE;
}
//aggregationType
String aggregationType = (String) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.AGGREGATIONTYPE, SubField.AGGREGATIONTYPE_NOTATION)));
if (aggregationType == null) {
aggregationType = Constants.NULL_VALUE;
}
// result
Object numValue = row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.VALUE, SubField.VALUE_VALUE_NUMERIC)));
Double value = (Double) numValue;
return new MeasureResult(startTimePos, endTimePos, validity, verification, aggregationType, value);
}
示例9: getProcedureIdList
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
/**
* This method can be used to retrieve the IDs of all procedures.
*
* @throws AutomationException
* @throws IOException
*/
public List<String> getProcedureIdList() throws AutomationException, IOException {
LOGGER.debug("Querying procedure list from DB.");
// set tables
List<String> tables = new ArrayList<String>();
tables.add(Table.PROCEDURE);
// LOGGER.info("Table clause := " + queryDef.getTables());
// set sub fields
List<String> subFields = new ArrayList<String>();
subFields.add(AccessGDBImpl.concatTableAndField(Table.PROCEDURE, SubField.PROCEDURE_ID));
// LOGGER.info("Subfields clause := " + queryDef.getSubFields());
// evaluate the database query
ICursor cursor = DatabaseUtils.evaluateQuery(AccessGDBImpl.createCommaSeparatedList(tables),
"", AccessGDBImpl.createCommaSeparatedList(subFields), gdb);
IRow row;
List<String> procedureIdList = new ArrayList<String>();
String key;
while ((row = cursor.nextRow()) != null) {
key = AccessGDBImpl.concatTableAndField(Table.PROCEDURE, SubField.PROCEDURE_ID);
String procedureId = row.getValue(subFields.indexOf(key)).toString();
procedureIdList.add(procedureId);
}
return procedureIdList;
}
示例10: getProceduresWithIdAndResource
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
/**
* This method returns all {@link Procedure}s for the identifiers given in the procedureIdentifierArray.
* HOWEVER: this method only fills the ID and RESOURCE attributes of the Procedures.
* REASON: much better performance AND more information in the end not needed.
*/
public Collection<Procedure> getProceduresWithIdAndResource(String[] procedureIdentifierArray) throws AutomationException, IOException
{
// set tables
List<String> tables = new ArrayList<String>();
tables.add(Table.PROCEDURE);
// LOGGER.info("Table clause := " + queryDef.getTables());
// set sub fields
List<String> subFields = new ArrayList<String>();
subFields.add(AccessGDBImpl.concatTableAndField(Table.PROCEDURE, SubField.PROCEDURE_ID));
subFields.add(AccessGDBImpl.concatTableAndField(Table.PROCEDURE, SubField.PROCEDURE_RESOURCE));
// LOGGER.info("Subfields clause := " + queryDef.getSubFields());
StringBuilder whereClause = new StringBuilder();
if (procedureIdentifierArray != null) {
whereClause.append(AccessGDBImpl.createOrClause(AccessGDBImpl.concatTableAndField(Table.PROCEDURE, SubField.PROCEDURE_ID), procedureIdentifierArray));
}
// LOGGER.info(queryDef.getWhereClause());
// evaluate the database query
ICursor cursor = DatabaseUtils.evaluateQuery(AccessGDBImpl.createCommaSeparatedList(tables),
whereClause.toString(), AccessGDBImpl.createCommaSeparatedList(subFields),
gdb);
IRow row;
List<Procedure> procedures = new ArrayList<Procedure>();
while ((row = cursor.nextRow()) != null) {
String id = row.getValue(subFields.indexOf(AccessGDBImpl.concatTableAndField(Table.PROCEDURE, SubField.PROCEDURE_ID))).toString();
String resource = (String) row.getValue(subFields.indexOf(AccessGDBImpl.concatTableAndField(Table.PROCEDURE, SubField.PROCEDURE_RESOURCE)));
procedures.add(new Procedure(id, resource));
}
return procedures;
}
示例11: getUnitsOfMeasure
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
@Override
public Map<Integer, Unit> getUnitsOfMeasure() throws IOException {
ICursor result = DatabaseUtils.evaluateQuery(Table.UNIT, null, "*", gdb);
Map<Integer, Unit> units = new HashMap<>();
IRow row;
Unit u;
while ((row = result.nextRow()) != null) {
u = Unit.fromRow(row);
units.put(u.getPkUnit(), u);
}
LOGGER.debug(String.format("Resolved units: %s", units));
return units;
}
示例12: fromRow
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
public static Unit fromRow(IRow row) throws NumberFormatException, AutomationException, IOException {
Unit result = new Unit();
IFields fields = row.getFields();
result.pkUnit = Integer.parseInt(row.getValue(fields.findField(SubField.UNIT_PK_UNIT)).toString());
result.id = row.getValue(fields.findField(SubField.UNIT_ID)).toString();
result.label = row.getValue(fields.findField(SubField.UNIT_LABEL)).toString();
result.notation = row.getValue(fields.findField(SubField.UNIT_NOTATION)).toString();
result.definition = row.getValue(fields.findField(SubField.UNIT_DEFINITION)).toString();
result.resource = row.getValue(fields.findField(SubField.UNIT_RESOURCE)).toString();
return result;
}
示例13: createMultiValueObservation
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
protected MultiValueObservation createMultiValueObservation(IRow row,
List<String> fields) throws IOException
{
// Identifier
String obsID = row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.OBSERVATION, SubField.OBSERVATION_ID))).toString();
Identifier obsIdentifier = new Identifier(null, obsID);
// procedure
String procID = (String) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.PROCEDURE, SubField.PROCEDURE_RESOURCE)));
if (procID == null) {
procID = Constants.NULL_VALUE;
}
// observed property
String obsPropID = (String) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.PROPERTY, SubField.PROPERTY_ID)));
if (obsPropID == null) {
obsPropID = Constants.NULL_VALUE;
}
// featureOfInterest
String featureID = (String) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.FEATUREOFINTEREST, SubField.FEATUREOFINTEREST_RESOURCE)));
if (featureID == null) {
featureID = Constants.NULL_VALUE;
}
// samplingFeature
String samplingPointID = (String) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.SAMPLINGPOINT, SubField.SAMPLINGPOINT_RESOURCE)));
// in case "resource" field is null, "id" field is used:
if (samplingPointID == null || samplingPointID.equals("")) {
samplingPointID = (String) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.SAMPLINGPOINT, SubField.SAMPLINGPOINT_ID)));
}
// unit ID
String unitID = (String) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.UNIT, SubField.UNIT_ID)));
if (unitID == null) {
unitID = Constants.NULL_VALUE;
}
// unit notation
String unitNotation = (String) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.UNIT, SubField.UNIT_NOTATION)));
if (unitNotation == null) {
unitNotation = Constants.NULL_VALUE;
}
// unit notation
String unitLabel = (String) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.UNIT, SubField.UNIT_LABEL)));
if (unitLabel == null) {
unitLabel = Constants.NULL_VALUE;
}
// aggregation type
String aggregationType = (String) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.AGGREGATIONTYPE, SubField.AGGREGATIONTYPE_DEFINITION)));
if (aggregationType == null) {
aggregationType = Constants.NULL_VALUE;
}
// result time
Date resultDate = (Date) row.getValue(fields.indexOf(AccessGDBImpl.concatTableAndField(Table.VALUE, SubField.VALUE_RESULTTIME)));
ITimePosition resultTimePos = TimeConverter.createTimeFromDate(resultDate, null);
return new MultiValueObservation(obsIdentifier, procID, obsPropID, featureID, samplingPointID, unitID, unitNotation, unitLabel, aggregationType, resultTimePos);
}
示例14: getPropertyUnitMappings
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
@Override
public Collection<PropertyUnitMapping> getPropertyUnitMappings() throws IOException {
PropertyUnitMapping result = new PropertyUnitMapping();
String subFields = AccessGDBImpl.createCommaSeparatedList(
AccessGDBImpl.concatTableAndField(Table.PROPERTY, SubField.PROPERTY_PK_PROPERTY),
AccessGDBImpl.concatTableAndField(Table.VALUE, SubField.VALUE_FK_UNIT)
);
String tables = AccessGDBImpl.createCommaSeparatedList(
Table.PROPERTY,
Table.OBSERVATION,
Table.VALUE
);
StringBuilder whereClause = new StringBuilder();
whereClause.append(AccessGDBImpl.concatTableAndField(Table.PROPERTY, SubField.PROPERTY_PK_PROPERTY));
whereClause.append(" = ");
whereClause.append(AccessGDBImpl.concatTableAndField(Table.OBSERVATION, SubField.OBSERVATION_FK_PROPERTY));
whereClause.append(" AND ");
whereClause.append(AccessGDBImpl.concatTableAndField(Table.OBSERVATION, SubField.OBSERVATION_PK_OBSERVATION));
whereClause.append(" = ");
whereClause.append(AccessGDBImpl.concatTableAndField(Table.VALUE, SubField.VALUE_FK_OBSERVATION));
whereClause.append(" AND ");
whereClause.append(AccessGDBImpl.concatTableAndField(Table.VALUE, SubField.VALUE_FK_UNIT));
whereClause.append(" IS NOT NULL");
ICursor cursor = DatabaseUtils.evaluateQuery(tables, whereClause.toString(),
"DISTINCT ".concat(subFields), gdb, true);
IRow row;
int count = 0;
while ((row = cursor.nextRow()) != null) {
LOGGER.debug("Working on row "+ count++);
String propertyId = row.getValue(0).toString();
String valueFkUnit = row.getValue(1).toString();
try {
Integer propertyIntId = Integer.parseInt(propertyId);
if (result.containsKey(propertyIntId)) {
LOGGER.warn(String.format("Multiple mappings for property '%s' - skipping candidate unit: '%s'",
propertyIntId, valueFkUnit));
} else {
result.put(propertyIntId, Integer.parseInt(valueFkUnit));
}
}
catch (NumberFormatException e) {
LOGGER.warn(e.getMessage(), e);
}
}
return Collections.singleton(result);
}
示例15: initList
import com.esri.arcgis.geodatabase.IRow; //导入依赖的package包/类
private void initList() {
fieldID = propCombo.getSelectionIndex();
list.removeAll();
try {
if (layers.toArray().length == 0) {
return;
}
Object objl = layers.toArray()[layerCombo.getSelectionIndex()];
ILayer layer = (ILayer) objl;
int fieldId = propCombo.getSelectionIndex();
IFeatureSelection featureSelection = null;
ICursor[] cursors = new ICursor[1];
IFeatureLayer featureLayer = new IFeatureLayerProxy(layer);
featureSelection = new IFeatureSelectionProxy(featureLayer);
ISelectionSet selectionSet = featureSelection.getSelectionSet();
int selectionCount = selectionSet.getCount();
if (selectionCount == 0) {
modifyinfo.setText("没有要素被选择");
return;
}
int type = selectionSet.getTarget().getFields().getField(fieldId)
.getType();
boolean editable = selectionSet.getTarget().getFields().getField(
fieldId).isEditable();
if (type != esriFieldType.esriFieldTypeDouble || !editable) {
modifyinfo.setText("此字段值不能更改");
return;
}
selectionSet.search(null, false, cursors);
rows = new IRow[selectionCount];
for (int i = 0; i < selectionCount; i++) {
rows[i] = cursors[0].nextRow();
double value = Double.parseDouble(rows[i].getValue(fieldId)
.toString());
value /= amplify;
list.add(Double.toString(value));
}
modifyinfo.setText("选择要更改列,在下方框内填写更改的值");
} catch (Exception e) {
modifyinfo.setText("未获取到字段值");
}
}