Skip to content

Commit

Permalink
#7: handle text extends for areas and pixel margins for soundings cor…
Browse files Browse the repository at this point in the history
…rectly
  • Loading branch information
andreas committed May 22, 2024
1 parent aec7a6d commit 4e7b192
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions provider/src/S57Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,28 @@ bool S57Object::RenderObject::Intersects(const Coord::PixelBox &pixelBox,Coord::
switch (object->geoPrimitive){
case s52::GEO_AREA:
case s52::GEO_LINE:
return object->extent.intersects(tile);
break;
{
bool rt = object->extent.intersects(tile);
if (rt)
return rt;
// areas could have some text that is larger then the area itself
// so just also consider the pixelExtent
if (object->geoPrimitive == s52::GEO_AREA)
{
Coord::PixelXy drawPoint = tile.worldToPixel(object->point);
if (pixelExtent.Valid())
{
return pixelBox.intersects(pixelExtent.getShifted(drawPoint));
}
return pixelBox.intersects(drawPoint);
}
return false;
}
break;
case s52::GEO_POINT:
if (object->soundigs.size() > 0){
Coord::PixelBox etx=Coord::worldExtentToPixel(object->extent,tile);
etx.expand(xmargin,ymargin);
return pixelBox.intersects(etx);
}
else{
Expand Down

0 comments on commit 4e7b192

Please sign in to comment.