Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

@@ -0,0 +1,152 @@
/**
**
** @RDE_HEADER@
** Implementation of path drawables
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Environment: Intel-PC
** Software-Environment: Windows 7, Qt 5.4. ArcGIS 10.2.5
**
** Language ........: C++ 11
**
** -----------------------------------------------------------------------------------------------
**
** Author ...........: Jörg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notes .........:
**
** 27.07.2015, JT : First edition for use with Qt5
**
** -----------------------------------------------------------------------------------------------
*/
#include "drawable_painter_path.h"
#include <QGraphicsPathItem>
#include <QPainterPath>
namespace SituationMap { namespace RB
{
DrawablePainterPath::DrawablePainterPath(Esri::ArcGISRuntime::MapGraphicsView * map)
: RubberbandDrawable(map)
, _painterPathItem(nullptr)
, _pathCoordinates()
, _lineStyle()
, _dottedPath(false)
, _closedLine(false)
, _fillSolid(false)
{
_painterPathItem = _scene->addPath( QPainterPath() );
_painterPathItem -> setFlags( QGraphicsItem::ItemIgnoresTransformations );
makeLineStyle( _dottedPath, _lineStyle );
_painterPathItem -> setPen ( (_drawColor.alpha()) ? QPen(_drawColor) : QPen() );
_fillColor.setAlpha(0);
_painterPathItem -> setBrush( (_fillColor.alpha()) ? QBrush(_fillColor) : QBrush() );
} /* DrawablePainterPath::DrawablePainterPath */
DrawablePainterPath::DrawablePainterPath(Esri::ArcGISRuntime::MapGraphicsView * map, QGraphicsScene * scene)
: RubberbandDrawable(map, scene)
, _painterPathItem(nullptr)
, _pathCoordinates()
, _lineStyle()
, _dottedPath(false)
, _closedLine(false)
, _fillSolid(false)
{
_painterPathItem = _scene->addPath( QPainterPath() );
_painterPathItem -> setFlags( QGraphicsItem::ItemIgnoresTransformations );
makeLineStyle( _dottedPath, _lineStyle );
_painterPathItem -> setPen ( (_drawColor.alpha()) ? _lineStyle : QPen() );
_fillColor.setAlpha(0);
_painterPathItem -> setBrush( (_fillColor.alpha()) ? QBrush(_fillColor) : QBrush() );
} /* DrawablePainterPath::DrawablePainterPath */
DrawablePainterPath::~DrawablePainterPath()
{
if (_scene)
{
if (_painterPathItem)
{
_scene->removeItem(_painterPathItem);
delete _painterPathItem;
}
_painterPathItem = nullptr;
}
} /* DrawablePainterPath::~DrawablePainterPath */
void DrawablePainterPath::setPath( const QVector<RubberbandDrawable::RubberbandCoordinate> & path )
{
_pathCoordinates = path;
updateGraphic();
} /* DrawablePainterPath::setPath */
void DrawablePainterPath::setPath( const QVector<QPointF> & scenePath )
{
_pathCoordinates.clear();
_pathCoordinates.reserve( scenePath.size() );
for ( auto p : scenePath )
{
_pathCoordinates.append( RubberbandDrawable::RubberbandCoordinate(_mapView,p) );
}
updateGraphic();
} /* DrawablePainterPath::setPath */
void DrawablePainterPath::updateGraphic()
{
DEBUG_LOG(_logger) << LOGFUNCTION;
if ((_closedLine) && (_pathCoordinates.size() < 3))
{
_painterPathItem -> setVisible( false );
return;
}
QPainterPath painterPath;
QVector<RubberbandDrawable::RubberbandCoordinate>::iterator it = _pathCoordinates.begin();
if (it != _pathCoordinates.end())
{
painterPath.moveTo( it->mapToScene(_mapView) );
DEBUG_LOG(_logger) << LOGFUNCTION << " map-x = " << it->_mapCoordinate.x() << " map-y = " << it->_mapCoordinate.y();
while (true)
{
++it;
if (it == _pathCoordinates.end()) break;
painterPath.lineTo( it->mapToScene(_mapView) );
DEBUG_LOG(_logger) << LOGFUNCTION << " map-x = " << it->_mapCoordinate.x() << " map-y = " << it->_mapCoordinate.y();
}
if (_closedLine) painterPath.closeSubpath();
}
const QColor &fillColor = transparentFillColor();
makeLineStyle( _dottedPath, _lineStyle );
_painterPathItem -> setVisible( _isVisible );
_painterPathItem -> setPen ( (_drawColor.alpha() > 0) ? _lineStyle : QPen() );
_painterPathItem -> setBrush( ( fillColor.alpha() > 0) ? QBrush(fillColor) : QBrush() );
_painterPathItem -> setZValue( _zBufferValue );
_painterPathItem -> setPath( painterPath );
} /* DrawablePainterPath::updateGraphic */
void DrawablePainterPath::adjustCoordinates() { updateGraphic(); }
void DrawablePainterPath::adjustWindow( const QRectF& ) { updateGraphic(); }
} } /* namespace SituationMap::RB */