-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Would you please comment the following code? Or explain what it is doing? I need to join data with features and finding hard to understand. I need to code to simply access features and join features with extended data from the external database. Would appreciate your guidance.
val resultSet = preparedStatement.executeQuery
try {
val dx = xmax - xmin
val dy = ymax - ymin
val px = new Array[Int](7)
val py = new Array[Int](7)
val hexCell = new HexCell(hexGrid.size)
while (resultSet.next) {
val loc = resultSet.getString(1)
val pop = resultSet.getInt(2)
val arr = loc.split(':')
val row = arr(0).toLong
val col = arr(1).toLong
val cellXY = hexGrid.convertRowColToHexXY(row, col)
var i = 0
while (i < 7) {
val hx = cellXY.x + hexCell.x(i)
val hy = cellXY.y + hexCell.y(i)
val fx = (hx - xmin) / dx
val fy = 1.0 - (hy - ymin) / dy
px(i) = (imgW * fx).toInt
py(i) = (imgH * fy).toInt
i += 1
}
val colorIndex = if (pop < minCount) 0
else if (pop > maxCount) 255
else math.floor(255 * (pop - minCount) / delCount).toInt
g.setColor(colorMapper.getColor(colorIndex))
g.fillPolygon(px, py, 7)
g.setColor(Color.GRAY)
g.drawPolygon(px, py, 7)
}
} finally {
resultSet.close()
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels