use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class MergedValuePredicate method isHighlighted.
@Override
public boolean isHighlighted(final Component renderer, final ComponentAdapter adapter) {
try {
final int rowIndex = adapter.convertRowIndexToView(adapter.row);
final int columnIndex = adapter.convertColumnIndexToView(adapter.column);
final Record record = this.model.getRecord(rowIndex);
final Record mergedRecord = this.model.getMergedRecord();
if (record == mergedRecord) {
return false;
} else {
final String fieldName = this.model.getColumnFieldName(columnIndex);
final FieldDefinition field = this.model.getColumnFieldDefinition(columnIndex);
if (field != null) {
final Object value = record.getValue(fieldName);
final Object mergedValue = mergedRecord.getValue(fieldName);
if (value instanceof Geometry) {
return false;
} else if (mergedValue instanceof Geometry) {
return false;
} else {
return !field.equals(value, mergedValue);
}
}
}
} catch (final IndexOutOfBoundsException e) {
}
return false;
}
use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class WikipediaBoundingBoxLayerWorker method handleBackground.
@Override
protected List<LayerRecord> handleBackground() {
BoundingBox boundingBox = this.boundingBox;
GeometryFactory geometryFactory = this.geometryFactory;
final CoordinateSystem coordinateSystem = geometryFactory.getCoordinateSystem();
if (coordinateSystem instanceof ProjectedCoordinateSystem) {
final ProjectedCoordinateSystem projCs = (ProjectedCoordinateSystem) coordinateSystem;
geometryFactory = projCs.getGeographicCoordinateSystem().getGeometryFactory();
boundingBox = boundingBox.convert(geometryFactory);
}
final List<LayerRecord> results = (List) this.geoNamesService.getWikipediaArticles(boundingBox);
for (final Record record : results) {
final String title = record.getValue("title");
final String wikipediaUrl = record.getValue("wikipediaUrl");
final String thumbnailImage = record.getValue("thumbnailImg");
final Point point = record.getGeometry();
String text;
if (thumbnailImage != null) {
text = "<html><b>" + title + "</b><br /><img src=\"" + thumbnailImage + "\" /><br /></html>";
} else {
text = "<html><b>" + title + "</b><br /></html>";
}
// if (viewport instanceof ComponentViewport2D) {
// final ComponentViewport2D componentViewport =
// (ComponentViewport2D)viewport;
// componentViewport.addHotSpot(geometryFactory, point, text, "http://"
// + wikipediaUrl);
// }
}
return results;
}
use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class RecordListCellRenderer method getListCellRendererComponent.
@Override
public Component getListCellRendererComponent(final JList list, final Object cellValue, final int index, final boolean isSelected, final boolean cellHasFocus) {
super.getListCellRendererComponent(list, cellValue, index, isSelected, cellHasFocus);
if (cellValue instanceof Record) {
final Record object = (Record) cellValue;
final Object value = object.getValue(this.fieldName);
final String text = DataTypes.toString(value);
setText(text);
}
return this;
}
use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class GeoNamesService method mapToObjects.
private List<Record> mapToObjects(final RecordDefinition recordDefinition, final Map<String, Object> result) {
final List<Record> results = new ArrayList<>();
final List<Map<String, Object>> names = (List<Map<String, Object>>) result.get("geonames");
for (final Map<String, Object> name : names) {
final Record record = recordDefinition.newRecord();
for (final String fieldName : recordDefinition.getFieldNames()) {
final Object value = name.get(fieldName);
if (value != null) {
record.setValue(fieldName, value);
}
}
final double lat = ((Number) name.get("lat")).doubleValue();
final double lon = ((Number) name.get("lng")).doubleValue();
Point coordinate = new PointDoubleXY(lon, lat);
final Number elevation = (Number) name.get("elevation");
if (elevation == null) {
coordinate = new PointDoubleXY(lon, lat);
} else {
coordinate = new PointDoubleXYZ(lon, lat, elevation.doubleValue());
}
record.setGeometryValue(GeometryFactory.DEFAULT_3D.point(coordinate));
results.add(record);
}
return results;
}
use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class AbstractProxyLayerRecord method setValue.
@Override
protected boolean setValue(final FieldDefinition fieldDefinition, final Object value) {
final int index = fieldDefinition.getIndex();
final Record record = getRecord();
return record.setValue(index, value);
}
Aggregations