// Create the rectangle that matches piece bounds
double angle = Math.atan2(this.yEnd - this.yStart, this.xEnd - this.xStart);
float dx = (float)-Math.sin(angle) * this.offset;
float dy = (float)Math.cos(angle) * this.offset;
GeneralPath dimensionLineShape = new GeneralPath();
// Append dimension line
dimensionLineShape.append(new Line2D.Float(this.xStart + dx, this.yStart + dy, this.xEnd + dx, this.yEnd + dy), false);
// Append extension lines
dimensionLineShape.append(new Line2D.Float(this.xStart, this.yStart, this.xStart + dx, this.yStart + dy), false);
dimensionLineShape.append(new Line2D.Float(this.xEnd, this.yEnd, this.xEnd + dx, this.yEnd + dy), false);
// Cache shape
this.shapeCache = dimensionLineShape;
}
return this.shapeCache;
}