_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q176100 | FeatureTiles.setDensity | test | public void setDensity(float density) {
this.density = density;
linePaint.setStrokeWidth(this.density * lineStrokeWidth);
polygonPaint.setStrokeWidth(this.density * polygonStrokeWidth);
featurePaintCache.clear();
} | java | {
"resource": ""
} |
q176101 | FeatureTiles.setLinePaint | test | public void setLinePaint(Paint linePaint) {
if (linePaint == null) {
throw new AssertionError("Line Paint can not be null");
}
this.linePaint = linePaint;
setLineStrokeWidth(linePaint.getStrokeWidth());
} | java | {
"resource": ""
} |
q176102 | FeatureTiles.setPolygonPaint | test | public void setPolygonPaint(Paint polygonPaint) {
if (polygonPaint == null) {
throw new AssertionError("Polygon Paint can not be null");
}
this.polygonPaint = polygonPaint;
setPolygonStrokeWidth(polygonPaint.getStrokeWidth());
} | java | {
"resource": ""
} |
q176103 | FeatureTiles.drawTileBytes | test | public byte[] drawTileBytes(int x, int y, int zoom) {
Bitmap bitmap = drawTile(x, y, zoom);
byte[] tileData = null;
// Convert the bitmap to bytes
if (bitmap != null) {
try {
tileData = BitmapConverter.toBytes(
bitmap, compressFormat);
} catch (IOException e) {
Log.e(FeatureTiles.class.getSimpleName(), "Failed to create tile. x: " + x + ", y: "
+ y + ", zoom: " + zoom, e);
} finally {
bitmap.recycle();
}
}
return tileData;
} | java | {
"resource": ""
} |
q176104 | FeatureTiles.drawTile | test | public Bitmap drawTile(int x, int y, int zoom) {
Bitmap bitmap;
if (isIndexQuery()) {
bitmap = drawTileQueryIndex(x, y, zoom);
} else {
bitmap = drawTileQueryAll(x, y, zoom);
}
return bitmap;
} | java | {
"resource": ""
} |
q176105 | FeatureTiles.drawTileQueryIndex | test | public Bitmap drawTileQueryIndex(int x, int y, int zoom) {
// Get the web mercator bounding box
BoundingBox webMercatorBoundingBox = TileBoundingBoxUtils
.getWebMercatorBoundingBox(x, y, zoom);
Bitmap bitmap = null;
// Query for geometries matching the bounds in the index
FeatureIndexResults results = queryIndexedFeatures(webMercatorBoundingBox);
try {
long tileCount = results.count();
// Draw if at least one geometry exists
if (tileCount > 0) {
if (maxFeaturesPerTile == null || tileCount <= maxFeaturesPerTile.longValue()) {
// Draw the tile bitmap
bitmap = drawTile(zoom, webMercatorBoundingBox, results);
} else if (maxFeaturesTileDraw != null) {
// Draw the max features tile
bitmap = maxFeaturesTileDraw.drawTile(tileWidth, tileHeight, tileCount, results);
}
}
} finally {
results.close();
}
return bitmap;
} | java | {
"resource": ""
} |
q176106 | FeatureTiles.queryIndexedFeaturesCount | test | public long queryIndexedFeaturesCount(int x, int y, int zoom) {
// Get the web mercator bounding box
BoundingBox webMercatorBoundingBox = TileBoundingBoxUtils
.getWebMercatorBoundingBox(x, y, zoom);
// Query for the count of geometries matching the bounds in the index
long count = queryIndexedFeaturesCount(webMercatorBoundingBox);
return count;
} | java | {
"resource": ""
} |
q176107 | FeatureTiles.queryIndexedFeaturesCount | test | public long queryIndexedFeaturesCount(BoundingBox webMercatorBoundingBox) {
// Query for geometries matching the bounds in the index
FeatureIndexResults results = queryIndexedFeatures(webMercatorBoundingBox);
long count = 0;
try {
count = results.count();
} finally {
results.close();
}
return count;
} | java | {
"resource": ""
} |
q176108 | FeatureTiles.queryIndexedFeatures | test | public FeatureIndexResults queryIndexedFeatures(int x, int y, int zoom) {
// Get the web mercator bounding box
BoundingBox webMercatorBoundingBox = TileBoundingBoxUtils
.getWebMercatorBoundingBox(x, y, zoom);
// Query for the geometries matching the bounds in the index
return queryIndexedFeatures(webMercatorBoundingBox);
} | java | {
"resource": ""
} |
q176109 | FeatureTiles.queryIndexedFeatures | test | public FeatureIndexResults queryIndexedFeatures(BoundingBox webMercatorBoundingBox) {
// Create an expanded bounding box to handle features outside the tile
// that overlap
BoundingBox expandedQueryBoundingBox = expandBoundingBox(webMercatorBoundingBox);
// Query for geometries matching the bounds in the index
FeatureIndexResults results = indexManager.query(expandedQueryBoundingBox, WEB_MERCATOR_PROJECTION);
return results;
} | java | {
"resource": ""
} |
q176110 | FeatureTiles.drawTileQueryAll | test | public Bitmap drawTileQueryAll(int x, int y, int zoom) {
BoundingBox boundingBox = TileBoundingBoxUtils
.getWebMercatorBoundingBox(x, y, zoom);
Bitmap bitmap = null;
// Query for all features
FeatureCursor cursor = featureDao.queryForAll();
try {
int totalCount = cursor.getCount();
// Draw if at least one geometry exists
if (totalCount > 0) {
if (maxFeaturesPerTile == null || totalCount <= maxFeaturesPerTile) {
// Draw the tile bitmap
bitmap = drawTile(zoom, boundingBox, cursor);
} else if (maxFeaturesTileDraw != null) {
// Draw the unindexed max features tile
bitmap = maxFeaturesTileDraw.drawUnindexedTile(tileWidth, tileHeight, totalCount, cursor);
}
}
} finally {
cursor.close();
}
return bitmap;
} | java | {
"resource": ""
} |
q176111 | FeatureTiles.simplifyPoints | test | protected List<Point> simplifyPoints(double simplifyTolerance,
List<Point> points) {
List<Point> simplifiedPoints = null;
if (simplifyGeometries) {
// Reproject to web mercator if not in meters
if (projection != null && !projection.isUnit(Units.METRES)) {
ProjectionTransform toWebMercator = projection
.getTransformation(WEB_MERCATOR_PROJECTION);
points = toWebMercator.transform(points);
}
// Simplify the points
simplifiedPoints = GeometryUtils.simplifyPoints(points,
simplifyTolerance);
// Reproject back to the original projection
if (projection != null && !projection.isUnit(Units.METRES)) {
ProjectionTransform fromWebMercator = WEB_MERCATOR_PROJECTION
.getTransformation(projection);
simplifiedPoints = fromWebMercator.transform(simplifiedPoints);
}
} else {
simplifiedPoints = points;
}
return simplifiedPoints;
} | java | {
"resource": ""
} |
q176112 | FeatureTiles.getPointPaint | test | protected Paint getPointPaint(FeatureStyle featureStyle) {
Paint paint = getFeatureStylePaint(featureStyle, FeatureDrawType.CIRCLE);
if (paint == null) {
paint = pointPaint;
}
return paint;
} | java | {
"resource": ""
} |
q176113 | FeatureTiles.getLinePaint | test | protected Paint getLinePaint(FeatureStyle featureStyle) {
Paint paint = getFeatureStylePaint(featureStyle, FeatureDrawType.STROKE);
if (paint == null) {
paint = linePaint;
}
return paint;
} | java | {
"resource": ""
} |
q176114 | FeatureTiles.getPolygonPaint | test | protected Paint getPolygonPaint(FeatureStyle featureStyle) {
Paint paint = getFeatureStylePaint(featureStyle, FeatureDrawType.STROKE);
if (paint == null) {
paint = polygonPaint;
}
return paint;
} | java | {
"resource": ""
} |
q176115 | FeatureTiles.getPolygonFillPaint | test | protected Paint getPolygonFillPaint(FeatureStyle featureStyle) {
Paint paint = null;
boolean hasStyleColor = false;
if (featureStyle != null) {
StyleRow style = featureStyle.getStyle();
if (style != null) {
if (style.hasFillColor()) {
paint = getStylePaint(style, FeatureDrawType.FILL);
} else {
hasStyleColor = style.hasColor();
}
}
}
if (paint == null && !hasStyleColor && fillPolygon) {
paint = polygonFillPaint;
}
return paint;
} | java | {
"resource": ""
} |
q176116 | FeatureTiles.getFeatureStylePaint | test | private Paint getFeatureStylePaint(FeatureStyle featureStyle, FeatureDrawType drawType) {
Paint paint = null;
if (featureStyle != null) {
StyleRow style = featureStyle.getStyle();
if (style != null && style.hasColor()) {
paint = getStylePaint(style, drawType);
}
}
return paint;
} | java | {
"resource": ""
} |
q176117 | FeatureTiles.getStylePaint | test | private Paint getStylePaint(StyleRow style, FeatureDrawType drawType) {
Paint paint = featurePaintCache.getPaint(style, drawType);
if (paint == null) {
Color color = null;
Style paintStyle = null;
Float strokeWidth = null;
switch (drawType) {
case CIRCLE:
color = style.getColorOrDefault();
paintStyle = Style.FILL;
break;
case STROKE:
color = style.getColorOrDefault();
paintStyle = Style.STROKE;
strokeWidth = this.density * (float) style.getWidthOrDefault();
break;
case FILL:
color = style.getFillColor();
paintStyle = Style.FILL;
strokeWidth = this.density * (float) style.getWidthOrDefault();
break;
default:
throw new GeoPackageException("Unsupported Draw Type: " + drawType);
}
Paint stylePaint = new Paint();
stylePaint.setAntiAlias(true);
stylePaint.setStyle(paintStyle);
stylePaint.setColor(color.getColorWithAlpha());
if (strokeWidth != null) {
stylePaint.setStrokeWidth(strokeWidth);
}
synchronized (featurePaintCache) {
paint = featurePaintCache.getPaint(style, drawType);
if (paint == null) {
featurePaintCache.setPaint(style, drawType, stylePaint);
paint = stylePaint;
}
}
}
return paint;
} | java | {
"resource": ""
} |
q176118 | FeaturePaintCache.getPaint | test | public Paint getPaint(StyleRow styleRow, FeatureDrawType type) {
return getPaint(styleRow.getId(), type);
} | java | {
"resource": ""
} |
q176119 | FeaturePaintCache.getPaint | test | public Paint getPaint(long styleId, FeatureDrawType type) {
Paint paint = null;
FeaturePaint featurePaint = getFeaturePaint(styleId);
if (featurePaint != null) {
paint = featurePaint.getPaint(type);
}
return paint;
} | java | {
"resource": ""
} |
q176120 | IconCache.put | test | public Bitmap put(IconRow iconRow, Bitmap bitmap) {
return put(iconRow.getId(), bitmap);
} | java | {
"resource": ""
} |
q176121 | IconCache.createIcon | test | public static Bitmap createIcon(IconRow icon, float density, IconCache iconCache) {
Bitmap iconImage = null;
if (icon != null) {
if (iconCache != null) {
iconImage = iconCache.get(icon.getId());
}
if (iconImage == null) {
BitmapFactory.Options options = icon.getDataBounds();
int dataWidth = options.outWidth;
int dataHeight = options.outHeight;
double styleWidth = dataWidth;
double styleHeight = dataHeight;
double widthDensity = DisplayMetrics.DENSITY_DEFAULT;
double heightDensity = DisplayMetrics.DENSITY_DEFAULT;
if (icon.getWidth() != null) {
styleWidth = icon.getWidth();
double widthRatio = dataWidth / styleWidth;
widthDensity *= widthRatio;
if (icon.getHeight() == null) {
heightDensity = widthDensity;
}
}
if (icon.getHeight() != null) {
styleHeight = icon.getHeight();
double heightRatio = dataHeight / styleHeight;
heightDensity *= heightRatio;
if (icon.getWidth() == null) {
widthDensity = heightDensity;
}
}
options = new BitmapFactory.Options();
options.inDensity = (int) (Math.min(widthDensity, heightDensity) + 0.5f);
options.inTargetDensity = (int) (DisplayMetrics.DENSITY_DEFAULT * density + 0.5f);
iconImage = icon.getDataBitmap(options);
if (widthDensity != heightDensity) {
int width = (int) (styleWidth * density + 0.5f);
int height = (int) (styleHeight * density + 0.5f);
if (width != iconImage.getWidth() || height != iconImage.getHeight()) {
Bitmap scaledBitmap = Bitmap.createScaledBitmap(iconImage, width, height, false);
iconImage.recycle();
iconImage = scaledBitmap;
}
}
if (iconCache != null) {
iconCache.put(icon.getId(), iconImage);
}
}
}
return iconImage;
} | java | {
"resource": ""
} |
q176122 | SQLUtils.quoteWrap | test | public static ContentValues quoteWrap(ContentValues values) {
ContentValues quoteValues = null;
if (values != null) {
Map<String, Object> quoteMap = new HashMap<>();
for (Map.Entry<String, Object> value : values.valueSet()) {
quoteMap.put(CoreSQLUtils.quoteWrap(value.getKey()), value.getValue());
}
Parcel parcel = Parcel.obtain();
parcel.writeMap(quoteMap);
parcel.setDataPosition(0);
quoteValues = ContentValues.CREATOR.createFromParcel(parcel);
parcel.recycle();
}
return quoteValues;
} | java | {
"resource": ""
} |
q176123 | FeatureTileCanvas.createBitmap | test | public Bitmap createBitmap() {
Bitmap bitmap = null;
Canvas canvas = null;
for (int layer = 0; layer < 4; layer++) {
Bitmap layerBitmap = layeredBitmap[layer];
if (layerBitmap != null) {
if (bitmap == null) {
bitmap = layerBitmap;
canvas = layeredCanvas[layer];
} else {
canvas.drawBitmap(layerBitmap, new Matrix(), null);
layerBitmap.recycle();
}
layeredBitmap[layer] = null;
layeredCanvas[layer] = null;
}
}
return bitmap;
} | java | {
"resource": ""
} |
q176124 | FeatureTileCanvas.recycle | test | public void recycle() {
for (int layer = 0; layer < 4; layer++) {
Bitmap bitmap = layeredBitmap[layer];
if (bitmap != null) {
bitmap.recycle();
layeredBitmap[layer] = null;
layeredCanvas[layer] = null;
}
}
} | java | {
"resource": ""
} |
q176125 | FeatureTileCanvas.getBitmap | test | private Bitmap getBitmap(int layer) {
Bitmap bitmap = layeredBitmap[layer];
if (bitmap == null) {
createBitmapAndCanvas(layer);
bitmap = layeredBitmap[layer];
}
return bitmap;
} | java | {
"resource": ""
} |
q176126 | FeatureTileCanvas.getCanvas | test | private Canvas getCanvas(int layer) {
Canvas canvas = layeredCanvas[layer];
if (canvas == null) {
createBitmapAndCanvas(layer);
canvas = layeredCanvas[layer];
}
return canvas;
} | java | {
"resource": ""
} |
q176127 | FeatureTileCanvas.createBitmapAndCanvas | test | private void createBitmapAndCanvas(int layer) {
layeredBitmap[layer] = Bitmap.createBitmap(tileWidth,
tileHeight, Bitmap.Config.ARGB_8888);
layeredCanvas[layer] = new Canvas(layeredBitmap[layer]);
} | java | {
"resource": ""
} |
q176128 | FeatureStyleExtension.getMappingDao | test | private StyleMappingDao getMappingDao(String tablePrefix,
String featureTable) {
String tableName = tablePrefix + featureTable;
StyleMappingDao dao = null;
if (geoPackage.isTable(tableName)) {
dao = new StyleMappingDao(relatedTables.getUserDao(tableName));
}
return dao;
} | java | {
"resource": ""
} |
q176129 | FeatureStyleExtension.getStyleDao | test | public StyleDao getStyleDao() {
StyleDao styleDao = null;
if (geoPackage.isTable(StyleTable.TABLE_NAME)) {
AttributesDao attributesDao = getGeoPackage().getAttributesDao(
StyleTable.TABLE_NAME);
styleDao = new StyleDao(attributesDao);
relatedTables.setContents(styleDao.getTable());
}
return styleDao;
} | java | {
"resource": ""
} |
q176130 | FeatureStyleExtension.getIconDao | test | public IconDao getIconDao() {
IconDao iconDao = null;
if (geoPackage.isTable(IconTable.TABLE_NAME)) {
iconDao = new IconDao(
relatedTables.getUserDao(IconTable.TABLE_NAME));
relatedTables.setContents(iconDao.getTable());
}
return iconDao;
} | java | {
"resource": ""
} |
q176131 | FeatureStyleExtension.getTableFeatureStyles | test | public FeatureStyles getTableFeatureStyles(String featureTable) {
FeatureStyles featureStyles = null;
Long id = contentsId.getId(featureTable);
if (id != null) {
Styles styles = getTableStyles(featureTable, id);
Icons icons = getTableIcons(featureTable, id);
if (styles != null || icons != null) {
featureStyles = new FeatureStyles(styles, icons);
}
}
return featureStyles;
} | java | {
"resource": ""
} |
q176132 | FeatureStyleExtension.getTableStyles | test | public Styles getTableStyles(String featureTable) {
Styles styles = null;
Long id = contentsId.getId(featureTable);
if (id != null) {
styles = getTableStyles(featureTable, id);
}
return styles;
} | java | {
"resource": ""
} |
q176133 | FeatureStyleExtension.getTableStyle | test | public StyleRow getTableStyle(String featureTable, GeometryType geometryType) {
StyleRow styleRow = null;
Styles tableStyles = getTableStyles(featureTable);
if (tableStyles != null) {
styleRow = tableStyles.getStyle(geometryType);
}
return styleRow;
} | java | {
"resource": ""
} |
q176134 | FeatureStyleExtension.getTableIcons | test | public Icons getTableIcons(String featureTable) {
Icons icons = null;
Long id = contentsId.getId(featureTable);
if (id != null) {
icons = getTableIcons(featureTable, id);
}
return icons;
} | java | {
"resource": ""
} |
q176135 | FeatureStyleExtension.getTableIcon | test | public IconRow getTableIcon(String featureTable, GeometryType geometryType) {
IconRow iconRow = null;
Icons tableIcons = getTableIcons(featureTable);
if (tableIcons != null) {
iconRow = tableIcons.getIcon(geometryType);
}
return iconRow;
} | java | {
"resource": ""
} |
q176136 | FeatureStyleExtension.getFeatureStyles | test | public FeatureStyles getFeatureStyles(FeatureRow featureRow) {
return getFeatureStyles(featureRow.getTable().getTableName(),
featureRow.getId());
} | java | {
"resource": ""
} |
q176137 | FeatureStyleExtension.getFeatureStyles | test | public FeatureStyles getFeatureStyles(String featureTable, long featureId) {
Styles styles = getStyles(featureTable, featureId);
Icons icons = getIcons(featureTable, featureId);
FeatureStyles featureStyles = null;
if (styles != null || icons != null) {
featureStyles = new FeatureStyles(styles, icons);
}
return featureStyles;
} | java | {
"resource": ""
} |
q176138 | FeatureStyleExtension.getStyles | test | public Styles getStyles(FeatureRow featureRow) {
return getStyles(featureRow.getTable().getTableName(),
featureRow.getId());
} | java | {
"resource": ""
} |
q176139 | FeatureStyleExtension.getIcons | test | public Icons getIcons(FeatureRow featureRow) {
return getIcons(featureRow.getTable().getTableName(),
featureRow.getId());
} | java | {
"resource": ""
} |
q176140 | FeatureStyleExtension.getStyles | test | private Styles getStyles(long featureId, StyleMappingDao mappingDao) {
Styles styles = null;
if (mappingDao != null) {
StyleDao styleDao = getStyleDao();
if (styleDao != null) {
List<StyleMappingRow> styleMappingRows = mappingDao
.queryByBaseFeatureId(featureId);
if (!styleMappingRows.isEmpty()) {
for (StyleMappingRow styleMappingRow : styleMappingRows) {
StyleRow styleRow = styleDao
.queryForRow(styleMappingRow);
if (styleRow != null) {
if (styles == null) {
styles = new Styles();
}
styles.setStyle(styleRow,
styleMappingRow.getGeometryType());
}
}
}
}
}
return styles;
} | java | {
"resource": ""
} |
q176141 | FeatureStyleExtension.getIcons | test | private Icons getIcons(long featureId, StyleMappingDao mappingDao) {
Icons icons = null;
if (mappingDao != null) {
IconDao iconDao = getIconDao();
if (iconDao != null) {
List<StyleMappingRow> styleMappingRows = mappingDao
.queryByBaseFeatureId(featureId);
if (!styleMappingRows.isEmpty()) {
for (StyleMappingRow styleMappingRow : styleMappingRows) {
IconRow iconRow = iconDao.queryForRow(styleMappingRow);
if (iconRow != null) {
if (icons == null) {
icons = new Icons();
}
icons.setIcon(iconRow,
styleMappingRow.getGeometryType());
}
}
}
}
}
return icons;
} | java | {
"resource": ""
} |
q176142 | FeatureStyleExtension.setTableFeatureStyles | test | public void setTableFeatureStyles(String featureTable,
FeatureStyles featureStyles) {
if (featureStyles != null) {
setTableStyles(featureTable, featureStyles.getStyles());
setTableIcons(featureTable, featureStyles.getIcons());
} else {
deleteTableFeatureStyles(featureTable);
}
} | java | {
"resource": ""
} |
q176143 | FeatureStyleExtension.setTableStyles | test | public void setTableStyles(String featureTable, Styles styles) {
deleteTableStyles(featureTable);
if (styles != null) {
if (styles.getDefault() != null) {
setTableStyleDefault(featureTable, styles.getDefault());
}
for (Entry<GeometryType, StyleRow> style : styles.getStyles()
.entrySet()) {
setTableStyle(featureTable, style.getKey(), style.getValue());
}
}
} | java | {
"resource": ""
} |
q176144 | FeatureStyleExtension.setTableIcons | test | public void setTableIcons(String featureTable, Icons icons) {
deleteTableIcons(featureTable);
if (icons != null) {
if (icons.getDefault() != null) {
setTableIconDefault(featureTable, icons.getDefault());
}
for (Entry<GeometryType, IconRow> icon : icons.getIcons()
.entrySet()) {
setTableIcon(featureTable, icon.getKey(), icon.getValue());
}
}
} | java | {
"resource": ""
} |
q176145 | FeatureStyleExtension.setFeatureStyles | test | public void setFeatureStyles(FeatureRow featureRow,
FeatureStyles featureStyles) {
setFeatureStyles(featureRow.getTable().getTableName(),
featureRow.getId(), featureStyles);
} | java | {
"resource": ""
} |
q176146 | FeatureStyleExtension.setFeatureStyles | test | public void setFeatureStyles(String featureTable, long featureId,
FeatureStyles featureStyles) {
if (featureStyles != null) {
setStyles(featureTable, featureId, featureStyles.getStyles());
setIcons(featureTable, featureId, featureStyles.getIcons());
} else {
deleteStyles(featureTable, featureId);
deleteIcons(featureTable, featureId);
}
} | java | {
"resource": ""
} |
q176147 | FeatureStyleExtension.setStyles | test | public void setStyles(FeatureRow featureRow, Styles styles) {
setStyles(featureRow.getTable().getTableName(), featureRow.getId(),
styles);
} | java | {
"resource": ""
} |
q176148 | FeatureStyleExtension.setStyles | test | public void setStyles(String featureTable, long featureId, Styles styles) {
deleteStyles(featureTable, featureId);
if (styles != null) {
if (styles.getDefault() != null) {
setStyleDefault(featureTable, featureId, styles.getDefault());
}
for (Entry<GeometryType, StyleRow> style : styles.getStyles()
.entrySet()) {
setStyle(featureTable, featureId, style.getKey(),
style.getValue());
}
}
} | java | {
"resource": ""
} |
q176149 | FeatureStyleExtension.setStyle | test | public void setStyle(FeatureRow featureRow, StyleRow style) {
setStyle(featureRow, featureRow.getGeometryType(), style);
} | java | {
"resource": ""
} |
q176150 | FeatureStyleExtension.setStyleDefault | test | public void setStyleDefault(FeatureRow featureRow, StyleRow style) {
setStyle(featureRow.getTable().getTableName(), featureRow.getId(),
null, style);
} | java | {
"resource": ""
} |
q176151 | FeatureStyleExtension.setStyleDefault | test | public void setStyleDefault(String featureTable, long featureId,
StyleRow style) {
setStyle(featureTable, featureId, null, style);
} | java | {
"resource": ""
} |
q176152 | FeatureStyleExtension.setIcons | test | public void setIcons(FeatureRow featureRow, Icons icons) {
setIcons(featureRow.getTable().getTableName(), featureRow.getId(),
icons);
} | java | {
"resource": ""
} |
q176153 | FeatureStyleExtension.setIcons | test | public void setIcons(String featureTable, long featureId, Icons icons) {
deleteIcons(featureTable, featureId);
if (icons != null) {
if (icons.getDefault() != null) {
setIconDefault(featureTable, featureId, icons.getDefault());
}
for (Entry<GeometryType, IconRow> icon : icons.getIcons()
.entrySet()) {
setIcon(featureTable, featureId, icon.getKey(), icon.getValue());
}
}
} | java | {
"resource": ""
} |
q176154 | FeatureStyleExtension.setIcon | test | public void setIcon(FeatureRow featureRow, IconRow icon) {
setIcon(featureRow, featureRow.getGeometryType(), icon);
} | java | {
"resource": ""
} |
q176155 | FeatureStyleExtension.setIconDefault | test | public void setIconDefault(FeatureRow featureRow, IconRow icon) {
setIcon(featureRow.getTable().getTableName(), featureRow.getId(), null,
icon);
} | java | {
"resource": ""
} |
q176156 | FeatureStyleExtension.setIconDefault | test | public void setIconDefault(String featureTable, long featureId, IconRow icon) {
setIcon(featureTable, featureId, null, icon);
} | java | {
"resource": ""
} |
q176157 | FeatureStyleExtension.getOrInsertStyle | test | private long getOrInsertStyle(StyleRow style) {
long styleId;
if (style.hasId()) {
styleId = style.getId();
} else {
StyleDao styleDao = getStyleDao();
styleId = styleDao.create(style);
}
return styleId;
} | java | {
"resource": ""
} |
q176158 | FeatureStyleExtension.getOrInsertIcon | test | private long getOrInsertIcon(IconRow icon) {
long iconId;
if (icon.hasId()) {
iconId = icon.getId();
} else {
IconDao iconDao = getIconDao();
iconId = iconDao.create(icon);
}
return iconId;
} | java | {
"resource": ""
} |
q176159 | FeatureStyleExtension.insertStyleMapping | test | private void insertStyleMapping(StyleMappingDao mappingDao, long baseId,
long relatedId, GeometryType geometryType) {
StyleMappingRow row = mappingDao.newRow();
row.setBaseId(baseId);
row.setRelatedId(relatedId);
row.setGeometryType(geometryType);
mappingDao.insert(row);
} | java | {
"resource": ""
} |
q176160 | FeatureStyleExtension.deleteTableStyle | test | public void deleteTableStyle(String featureTable, GeometryType geometryType) {
deleteTableMapping(getTableStyleMappingDao(featureTable), featureTable,
geometryType);
} | java | {
"resource": ""
} |
q176161 | FeatureStyleExtension.deleteTableIcon | test | public void deleteTableIcon(String featureTable, GeometryType geometryType) {
deleteTableMapping(getTableIconMappingDao(featureTable), featureTable,
geometryType);
} | java | {
"resource": ""
} |
q176162 | FeatureStyleExtension.deleteTableMappings | test | private void deleteTableMappings(StyleMappingDao mappingDao,
String featureTable) {
if (mappingDao != null) {
Long featureContentsId = contentsId.getId(featureTable);
if (featureContentsId != null) {
mappingDao.deleteByBaseId(featureContentsId);
}
}
} | java | {
"resource": ""
} |
q176163 | FeatureStyleExtension.deleteTableMapping | test | private void deleteTableMapping(StyleMappingDao mappingDao,
String featureTable, GeometryType geometryType) {
if (mappingDao != null) {
Long featureContentsId = contentsId.getId(featureTable);
if (featureContentsId != null) {
mappingDao.deleteByBaseId(featureContentsId, geometryType);
}
}
} | java | {
"resource": ""
} |
q176164 | FeatureStyleExtension.deleteMapping | test | private void deleteMapping(StyleMappingDao mappingDao, long featureId,
GeometryType geometryType) {
if (mappingDao != null) {
mappingDao.deleteByBaseId(featureId, geometryType);
}
} | java | {
"resource": ""
} |
q176165 | FeatureStyleExtension.getAllTableStyleIds | test | public List<Long> getAllTableStyleIds(String featureTable) {
List<Long> styleIds = null;
StyleMappingDao mappingDao = getTableStyleMappingDao(featureTable);
if (mappingDao != null) {
styleIds = mappingDao.uniqueRelatedIds();
}
return styleIds;
} | java | {
"resource": ""
} |
q176166 | FeatureStyleExtension.getAllTableIconIds | test | public List<Long> getAllTableIconIds(String featureTable) {
List<Long> iconIds = null;
StyleMappingDao mappingDao = getTableIconMappingDao(featureTable);
if (mappingDao != null) {
iconIds = mappingDao.uniqueRelatedIds();
}
return iconIds;
} | java | {
"resource": ""
} |
q176167 | FeatureStyleExtension.getAllStyleIds | test | public List<Long> getAllStyleIds(String featureTable) {
List<Long> styleIds = null;
StyleMappingDao mappingDao = getStyleMappingDao(featureTable);
if (mappingDao != null) {
styleIds = mappingDao.uniqueRelatedIds();
}
return styleIds;
} | java | {
"resource": ""
} |
q176168 | FeatureStyleExtension.getAllIconIds | test | public List<Long> getAllIconIds(String featureTable) {
List<Long> iconIds = null;
StyleMappingDao mappingDao = getIconMappingDao(featureTable);
if (mappingDao != null) {
iconIds = mappingDao.uniqueRelatedIds();
}
return iconIds;
} | java | {
"resource": ""
} |
q176169 | CoverageDataPngImage.getImageBytes | test | public byte[] getImageBytes() {
byte[] bytes = null;
if (imageBytes != null) {
bytes = imageBytes;
} else if (outputStream != null) {
bytes = outputStream.toByteArray();
}
return bytes;
} | java | {
"resource": ""
} |
q176170 | CoverageDataPngImage.flushStream | test | public void flushStream() {
if (outputStream != null) {
if (imageBytes == null) {
imageBytes = outputStream.toByteArray();
}
try {
outputStream.close();
} catch (IOException e) {
Log.w(CoverageDataPngImage.class.getSimpleName(), "Failed to close output stream", e);
}
}
} | java | {
"resource": ""
} |
q176171 | CoverageDataPngImage.getPixel | test | public int getPixel(int x, int y) {
int pixel = -1;
if (pixels == null) {
readPixels();
}
if (pixels != null) {
pixel = pixels[y][x];
} else {
throw new GeoPackageException("Could not retrieve pixel value");
}
return pixel;
} | java | {
"resource": ""
} |
q176172 | CoverageDataPngImage.readPixels | test | private void readPixels() {
if (reader != null) {
pixels = new int[reader.imgInfo.rows][reader.imgInfo.cols];
int rowCount = 0;
while (reader.hasMoreRows()) {
ImageLineInt row = reader.readRowInt();
int[] columnValues = new int[reader.imgInfo.cols];
System.arraycopy(row.getScanline(), 0, columnValues, 0, columnValues.length);
pixels[rowCount++] = columnValues;
}
reader.close();
}
} | java | {
"resource": ""
} |
q176173 | DefaultFeatureTiles.drawFeature | test | private boolean drawFeature(int zoom, BoundingBox boundingBox, BoundingBox expandedBoundingBox, ProjectionTransform transform, FeatureTileCanvas canvas, FeatureRow row) {
boolean drawn = false;
try {
GeoPackageGeometryData geomData = row.getGeometry();
if (geomData != null) {
Geometry geometry = geomData.getGeometry();
if (geometry != null) {
GeometryEnvelope envelope = geomData.getOrBuildEnvelope();
BoundingBox geometryBoundingBox = new BoundingBox(envelope);
BoundingBox transformedBoundingBox = geometryBoundingBox.transform(transform);
if (expandedBoundingBox.intersects(transformedBoundingBox, true)) {
double simplifyTolerance = TileBoundingBoxUtils.toleranceDistance(zoom, tileWidth, tileHeight);
drawn = drawShape(simplifyTolerance, boundingBox, transform, canvas, row, geometry);
}
}
}
} catch (Exception e) {
Log.e(DefaultFeatureTiles.class.getSimpleName(), "Failed to draw feature in tile. Table: "
+ featureDao.getTableName(), e);
}
return drawn;
} | java | {
"resource": ""
} |
q176174 | DefaultFeatureTiles.drawLinePath | test | private boolean drawLinePath(FeatureTileCanvas canvas, Path path, FeatureStyle featureStyle) {
Canvas lineCanvas = canvas.getLineCanvas();
Paint pathPaint = getLinePaint(featureStyle);
lineCanvas.drawPath(path, pathPaint);
return true;
} | java | {
"resource": ""
} |
q176175 | DefaultFeatureTiles.drawPolygonPath | test | private boolean drawPolygonPath(FeatureTileCanvas canvas, Path path, FeatureStyle featureStyle) {
Canvas polygonCanvas = canvas.getPolygonCanvas();
Paint fillPaint = getPolygonFillPaint(featureStyle);
if (fillPaint != null) {
path.setFillType(Path.FillType.EVEN_ODD);
polygonCanvas.drawPath(path, fillPaint);
}
Paint pathPaint = getPolygonPaint(featureStyle);
polygonCanvas.drawPath(path, pathPaint);
return true;
} | java | {
"resource": ""
} |
q176176 | DefaultFeatureTiles.addLineString | test | private void addLineString(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, LineString lineString) {
List<Point> points = lineString.getPoints();
if (points.size() >= 2) {
// Try to simplify the number of points in the LineString
points = simplifyPoints(simplifyTolerance, points);
for (int i = 0; i < points.size(); i++) {
Point point = points.get(i);
Point webMercatorPoint = transform.transform(point);
float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox,
webMercatorPoint.getX());
float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox,
webMercatorPoint.getY());
if (i == 0) {
path.moveTo(x, y);
} else {
path.lineTo(x, y);
}
}
}
} | java | {
"resource": ""
} |
q176177 | DefaultFeatureTiles.addPolygon | test | private void addPolygon(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, Polygon polygon) {
List<LineString> rings = polygon.getRings();
if (!rings.isEmpty()) {
// Add the polygon points
LineString polygonLineString = rings.get(0);
List<Point> polygonPoints = polygonLineString.getPoints();
if (polygonPoints.size() >= 2) {
addRing(simplifyTolerance, boundingBox, transform, path, polygonPoints);
// Add the holes
for (int i = 1; i < rings.size(); i++) {
LineString holeLineString = rings.get(i);
List<Point> holePoints = holeLineString.getPoints();
if (holePoints.size() >= 2) {
addRing(simplifyTolerance, boundingBox, transform, path, holePoints);
}
}
}
}
} | java | {
"resource": ""
} |
q176178 | FeatureCacheTables.getCache | test | public FeatureCache getCache(String tableName) {
FeatureCache cache = tableCache.get(tableName);
if (cache == null) {
cache = new FeatureCache(maxCacheSize);
tableCache.put(tableName, cache);
}
return cache;
} | java | {
"resource": ""
} |
q176179 | FeatureCacheTables.remove | test | public FeatureRow remove(FeatureRow featureRow) {
return remove(featureRow.getTable().getTableName(), featureRow.getId());
} | java | {
"resource": ""
} |
q176180 | FeatureCacheTables.clearAndResize | test | public void clearAndResize(int maxCacheSize) {
setMaxCacheSize(maxCacheSize);
for (FeatureCache cache : tableCache.values()) {
cache.clearAndResize(maxCacheSize);
}
} | java | {
"resource": ""
} |
q176181 | FeatureTableStyles.getCachedTableStyles | test | public Styles getCachedTableStyles() {
Styles styles = cachedTableFeatureStyles.getStyles();
if (styles == null) {
synchronized (cachedTableFeatureStyles) {
styles = cachedTableFeatureStyles.getStyles();
if (styles == null) {
styles = getTableStyles();
if (styles == null) {
styles = new Styles();
}
cachedTableFeatureStyles.setStyles(styles);
}
}
}
if (styles.isEmpty()) {
styles = null;
}
return styles;
} | java | {
"resource": ""
} |
q176182 | FeatureTableStyles.getCachedTableIcons | test | public Icons getCachedTableIcons() {
Icons icons = cachedTableFeatureStyles.getIcons();
if (icons == null) {
synchronized (cachedTableFeatureStyles) {
icons = cachedTableFeatureStyles.getIcons();
if (icons == null) {
icons = getTableIcons();
if (icons == null) {
icons = new Icons();
}
cachedTableFeatureStyles.setIcons(icons);
}
}
}
if (icons.isEmpty()) {
icons = null;
}
return icons;
} | java | {
"resource": ""
} |
q176183 | RTreeIndexExtension.getTableDao | test | public RTreeIndexTableDao getTableDao(FeatureDao featureDao) {
GeoPackageConnection connection = getGeoPackage().getConnection();
UserCustomConnection userDb = new UserCustomConnection(connection);
UserCustomTable userCustomTable = getRTreeTable(featureDao.getTable());
UserCustomDao userCustomDao = new UserCustomDao(geoPackage.getName(),
connection, userDb, userCustomTable);
return new RTreeIndexTableDao(this, userCustomDao, featureDao);
} | java | {
"resource": ""
} |
q176184 | IconRow.setWidth | test | public void setWidth(Double width) {
if (width != null && width < 0.0) {
throw new GeoPackageException(
"Width must be greater than or equal to 0.0, invalid value: "
+ width);
}
setValue(getWidthColumnIndex(), width);
} | java | {
"resource": ""
} |
q176185 | IconRow.setHeight | test | public void setHeight(Double height) {
if (height != null && height < 0.0) {
throw new GeoPackageException(
"Height must be greater than or equal to 0.0, invalid value: "
+ height);
}
setValue(getHeightColumnIndex(), height);
} | java | {
"resource": ""
} |
q176186 | IconRow.getDerivedDimensions | test | public double[] getDerivedDimensions() {
Double width = getWidth();
Double height = getHeight();
if (width == null || height == null) {
BitmapFactory.Options options = getDataBounds();
int dataWidth = options.outWidth;
int dataHeight = options.outHeight;
if (width == null) {
width = (double) dataWidth;
if (height != null) {
width *= (height / dataHeight);
}
}
if (height == null) {
height = (double) dataHeight;
if (width != null) {
height *= (width / dataWidth);
}
}
}
return new double[]{width, height};
} | java | {
"resource": ""
} |
q176187 | TileUtils.tileDensity | test | public static float tileDensity(float density, int tileWidth, int tileHeight) {
return tileDensity(density, Math.min(tileWidth, tileHeight));
} | java | {
"resource": ""
} |
q176188 | UserInvalidCursor.readBlobValue | test | private void readBlobValue(UserRow row, UserColumn column) {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
try {
byte[] blobChunk = new byte[]{0};
for (int i = 1; blobChunk.length > 0; i += CHUNK_SIZE) {
if (i > 1) {
byteStream.write(blobChunk);
}
blobChunk = new byte[]{};
String query = "select substr(" +
CoreSQLUtils.quoteWrap(column.getName()) + ", " + i + ", " + CHUNK_SIZE + ") from "
+ CoreSQLUtils.quoteWrap(dao.getTableName()) + " where "
+ CoreSQLUtils.quoteWrap(row.getPkColumn().getName()) + " = " + row.getId();
Cursor blobCursor = dao.getDatabaseConnection().getDb().rawQuery(query, null);
try {
if (blobCursor.moveToNext()) {
blobChunk = blobCursor.getBlob(0);
}
} finally {
blobCursor.close();
}
}
byte[] blob = byteStream.toByteArray();
row.setValue(column.getIndex(), blob);
} catch (IOException e) {
Log.e(UserInvalidCursor.class.getSimpleName(), "Failed to read large blob value. Table: "
+ dao.getTableName() + ", Column: " + column.getName() + ", Position: " + getPosition(), e);
} finally {
IOUtils.closeQuietly(byteStream);
}
} | java | {
"resource": ""
} |
q176189 | UserCustomTableReader.readTable | test | public static UserCustomTable readTable(GeoPackageConnection connection,
String tableName) {
UserCustomTableReader tableReader = new UserCustomTableReader(tableName);
UserCustomTable customTable = tableReader.readTable(new UserCustomWrapperConnection(connection));
return customTable;
} | java | {
"resource": ""
} |
q176190 | StyleRow.getColorOrDefault | test | public Color getColorOrDefault() {
Color color = getColor();
if (color == null) {
color = new Color();
}
return color;
} | java | {
"resource": ""
} |
q176191 | StyleRow.validateColor | test | private String validateColor(String color) {
String validated = color;
if (color != null) {
if (!color.startsWith("#")) {
validated = "#" + color;
}
if (!colorPattern.matcher(validated).matches()) {
throw new GeoPackageException(
"Color must be in hex format #RRGGBB or #RGB, invalid value: "
+ color);
}
validated = validated.toUpperCase();
}
return validated;
} | java | {
"resource": ""
} |
q176192 | StyleRow.createColor | test | private Color createColor(String hexColor, Double opacity) {
Color color = null;
if (hexColor != null || opacity != null) {
color = new Color();
if (hexColor != null) {
color.setColor(hexColor);
}
if (opacity != null) {
color.setOpacity(opacity.floatValue());
}
}
return color;
} | java | {
"resource": ""
} |
q176193 | GeoPackageFactory.getManager | test | public static GeoPackageManager getManager(Context context) {
Thread.currentThread().setContextClassLoader(GeoPackageManager.class.getClassLoader());
return new GeoPackageManagerImpl(context);
} | java | {
"resource": ""
} |
q176194 | FeatureIndexManager.setProgress | test | public void setProgress(GeoPackageProgress progress) {
featureTableIndex.setProgress(progress);
featureIndexer.setProgress(progress);
rTreeIndexTableDao.setProgress(progress);
} | java | {
"resource": ""
} |
q176195 | FeatureIndexManager.index | test | public int index(boolean force, List<FeatureIndexType> types) {
int count = 0;
for (FeatureIndexType type : types) {
int typeCount = index(type, force);
count = Math.max(count, typeCount);
}
return count;
} | java | {
"resource": ""
} |
q176196 | FeatureIndexManager.index | test | public boolean index(FeatureRow row, List<FeatureIndexType> types) {
boolean indexed = false;
for (FeatureIndexType type : types) {
if (index(type, row)) {
indexed = true;
}
}
return indexed;
} | java | {
"resource": ""
} |
q176197 | FeatureIndexManager.deleteIndex | test | public boolean deleteIndex(Collection<FeatureIndexType> types) {
boolean deleted = false;
for (FeatureIndexType type : types) {
if (deleteIndex(type)) {
deleted = true;
}
}
return deleted;
} | java | {
"resource": ""
} |
q176198 | FeatureIndexManager.deleteIndex | test | public boolean deleteIndex(FeatureRow row, List<FeatureIndexType> types) {
boolean deleted = false;
for (FeatureIndexType type : types) {
if (deleteIndex(type, row)) {
deleted = true;
}
}
return deleted;
} | java | {
"resource": ""
} |
q176199 | FeatureIndexManager.deleteIndex | test | public boolean deleteIndex(long geomId, List<FeatureIndexType> types) {
boolean deleted = false;
for (FeatureIndexType type : types) {
if (deleteIndex(type, geomId)) {
deleted = true;
}
}
return deleted;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.