Files
qt-migration-legatus/qt5-before/dlbo/Lts/Viewer/SituationMap/Rubberbands/drawable_ellipse.cpp
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

128 lines
4.3 KiB
C++

/**
**
** @RDE_HEADER@
** Definition of ellipse drawable
** $Id$
** $HeadURL$
** $Author$
*/
#include "drawable_ellipse.h"
#include <MathUtils/math_const.h>
#include <QtWidgets/QGraphicsEllipseItem>
namespace SituationMap { namespace RB
{
DrawableEllipse::DrawableEllipse(Esri::ArcGISRuntime::MapGraphicsView * map) : DrawableEllipse(map,map->scene()) {;}
DrawableEllipse::DrawableEllipse(Esri::ArcGISRuntime::MapGraphicsView * map, QGraphicsScene * scene)
: RubberbandDrawable(map, scene)
, _elliItem(nullptr)
, _center()
, _radiusX(0)
, _radiusY(0)
, _elliStyle()
, _sinRect(0)
, _cosRect(1)
, _sectorStart()
, _sectorEnd()
{
_elliItem = new QGraphicsEllipseItem();
_scene -> addItem( _elliItem );
makeLineStyle( false, _elliStyle );
_elliItem -> setPen( _elliStyle );
_sectItem = new QGraphicsEllipseItem();
_scene -> addItem( _sectItem );
makeLineStyle( false, _elliStyle );
_sectItem -> setPen( _elliStyle );
} /* DrawableLine::DrawableLine */
DrawableEllipse::~DrawableEllipse()
{
if (_scene)
{
if (_elliItem) _scene->removeItem(_elliItem);
if (_sectItem) _scene->removeItem(_sectItem);
delete _elliItem;
delete _sectItem;
}
_elliItem = nullptr;
_sectItem = nullptr;
} /* DrawableEllipse::~DrawableEllipse */
void DrawableEllipse::updateGraphic()
{
auto length = []( const QPointF & p ) -> qreal { return sqrt(p.x()*p.x()+p.y()*p.y()); };
qreal mapRotatePhi = _mapView->mapRotation() * MathConst::pi / 180.0;
qreal sinMap = sin(mapRotatePhi);
qreal cosMap = cos(mapRotatePhi);
qreal sinPhi = _sinRect * cosMap + _cosRect * sinMap;
qreal cosPhi = _cosRect * cosMap - _sinRect * sinMap;
_center.mapToScene(_mapView);
QPointF mapCenter( _center._mapCoordinate.x(), _center._mapCoordinate.y() );
RubberbandCoordinate x0y0(_mapView, convert( mapCenter+QPointF(-_radiusX,-_radiusY), _mapView->map()->spatialReference()) );
RubberbandCoordinate x1y0(_mapView, convert( mapCenter+QPointF( _radiusX,-_radiusY), _mapView->map()->spatialReference()) );
RubberbandCoordinate x0y1(_mapView, convert( mapCenter+QPointF(-_radiusX, _radiusY), _mapView->map()->spatialReference()) );
qreal width = length(x1y0._sceneCoordinate-x0y0._sceneCoordinate);
qreal height = length(x0y1._sceneCoordinate-x0y0._sceneCoordinate);
makeLineStyle( false, _elliStyle );
QColor fillColor = transparentFillColor();
//fillColor.setAlpha(0);
QPen pen(_drawColor);
pen.setWidth(_lineWidth);
if (_sectorStart != _sectorEnd)
{
auto getAngle = [](qreal sinPhi, qreal cosPhi) -> int
{
qreal phi = acos( cosPhi );
if (sinPhi < 0) phi = MathConst::pi_two - phi;
return int( (phi * 180.0 / MathConst::pi) * 16);
}; // getAngle
int startAngle = getAngle(_sectorStart.y(), _sectorStart.x());
int endAngle = getAngle( _sectorEnd.y(), _sectorEnd.x());
int spanAngle = (endAngle > startAngle) ? endAngle-startAngle : 5760-startAngle+endAngle;
_sectItem -> setRect( -width*0.5, -height*0.5, width, height );
_sectItem -> setPen( pen );
_sectItem -> setBrush( (fillColor.alpha() > 0) ? QBrush(fillColor) : QBrush() );
_sectItem -> setTransform( QTransform( cosPhi, -sinPhi, sinPhi, cosPhi, _center._sceneCoordinate.x(), _center._sceneCoordinate.y() ));
_sectItem -> setStartAngle( startAngle );
_sectItem -> setSpanAngle( spanAngle );
_sectItem -> setVisible( true );
fillColor.setAlphaF(fillColor.alphaF() * 0.5 );
}
else _sectItem -> setVisible( false );
_elliItem -> setRect( -width*0.5, -height*0.5, width, height );
_elliItem -> setPen(pen);
_elliItem -> setBrush( (fillColor.alpha() > 0) ? QBrush(fillColor) : QBrush() );
_elliItem -> setTransform( QTransform( cosPhi, -sinPhi, sinPhi, cosPhi, _center._sceneCoordinate.x(), _center._sceneCoordinate.y() ));
} /* DrawableEllipse::updateGraphic */
void DrawableEllipse::adjustCoordinates() { updateGraphic(); }
void DrawableEllipse::adjustWindow( const QRectF& ) { updateGraphic(); }
} } /* namespace SituationMap::RB */