Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,133 @@
|
||||
|
||||
/**
|
||||
**
|
||||
** @RDE_HEADER@
|
||||
** Implementation of rubberband class to define point feature geoemtry
|
||||
** $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.03.2015, JT : First edition for use with Qt5
|
||||
**
|
||||
** -----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "rubberband_point_cluster.h"
|
||||
#include "rubberband_point_handle.h"
|
||||
#include "rubberband_drawable.h"
|
||||
#include "rubberband_handle_proxy.h"
|
||||
#include "transient_tactical_symbol.h"
|
||||
|
||||
#include "rubberband_internal.h"
|
||||
#include "rubberband_base_internal.h"
|
||||
|
||||
namespace SituationMap { namespace RB
|
||||
{
|
||||
|
||||
struct RubberbandPointCluster::InternalData
|
||||
{
|
||||
Q_DISABLE_COPY(InternalData)
|
||||
InternalData() = default;
|
||||
SituationMap::RefPointer<TransientTacticalSymbol> _previewSymbol;
|
||||
}; /* RubberbandMultiPointFeature::InternalData */
|
||||
|
||||
|
||||
RubberbandPointCluster::RubberbandPointCluster( SituationMap::Map * map, QObject * parent, bool isActive ) : RubberbandPointCluster( map, INT_MAX, parent, isActive ) {;}
|
||||
|
||||
|
||||
RubberbandPointCluster::RubberbandPointCluster( SituationMap::Map * map, unsigned int maxCoordinates, QObject * parent, bool isActive )
|
||||
: RubberbandPointFeature(map,parent,isActive), _internal(new InternalData()), _minimalPointCount(1)
|
||||
{
|
||||
_maximalPointCount = maxCoordinates;
|
||||
} /* RubberbandPointCluster::RubberbandPointCluster */
|
||||
|
||||
|
||||
RubberbandPointCluster::~RubberbandPointCluster()
|
||||
{
|
||||
delete _internal;
|
||||
} /* RubberbandPointCluster::~RubberbandPointCluster */
|
||||
|
||||
|
||||
void RubberbandPointCluster::activateButtons()
|
||||
{
|
||||
_baseInternal->_hasUndoButton = isEnabledConstructionState();
|
||||
_baseInternal->_applyIsPossible = (static_cast<unsigned int>(Rubberband::_internal->_handleList.size()) >= _minimalPointCount);
|
||||
_baseInternal->_undoIsPossible = (isEnabledConstructionState() && (static_cast<unsigned int>(Rubberband::_internal->_handleList.size()) > _minimalPointCount));
|
||||
Rubberband::activateButtons();
|
||||
} /* RubberbandMultiPointFeature::activateButton */
|
||||
|
||||
|
||||
void RubberbandPointCluster::setCoordinateVector(const QVector<QPointF> & coordinateVector, CoordinateSystem cs )
|
||||
{
|
||||
RubberbandPointFeature::setCoordinateVector( coordinateVector, cs );
|
||||
enableModificationState();
|
||||
activateButtons();
|
||||
} /* RubberbandPointCluster::setCoordinateVector */
|
||||
|
||||
|
||||
bool RubberbandPointCluster::setCoordinateAction( AbstractEventDispatcher * causer, int x, int y )
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
if (rubberbandIsAlive())
|
||||
{
|
||||
ok = RubberbandPointFeature::setCoordinateAction(causer,x,y);
|
||||
if (ok) activateButtons();
|
||||
}
|
||||
return ok;
|
||||
} /* RubberbandPointCluster::setCoordinateAction */
|
||||
|
||||
|
||||
void RubberbandPointCluster::update()
|
||||
{
|
||||
RubberbandPointFeature::update();
|
||||
if (!_previewSidc.isEmpty())
|
||||
{
|
||||
if (!_internal->_previewSymbol)
|
||||
{
|
||||
_internal->_previewSymbol = new TransientTacticalSymbol( static_cast<MapImpl*>(_baseInternal->_map.data()), _previewSidc );
|
||||
}
|
||||
|
||||
QVector<RubberbandHandle::RubberbandCoordinate> coordinateList;
|
||||
coordinateList.reserve( Rubberband::_internal->_handleList.size() );
|
||||
|
||||
for (auto handlePoint : qAsConst(Rubberband::_internal->_handleList))
|
||||
{
|
||||
RubberbandPointHandle * handlePointPtr = dynamic_cast<RubberbandPointHandle*>(handlePoint.get());
|
||||
if (handlePointPtr)
|
||||
{
|
||||
coordinateList.append( handlePointPtr->getCoordinate() );
|
||||
}
|
||||
}
|
||||
_internal->_previewSymbol->update( coordinateList );
|
||||
}
|
||||
else _internal->_previewSymbol = nullptr;
|
||||
} /* RubberbandPointCluster::update */
|
||||
|
||||
|
||||
bool RubberbandPointCluster::deleteAction(AbstractEventDispatcher * causer, int x, int y)
|
||||
{
|
||||
if (rubberbandIsAlive())
|
||||
{
|
||||
if (static_cast<unsigned int>(RubberbandPointFeature::_internal->_handleList.size()) <= _minimalPointCount) return true;
|
||||
return RubberbandPointFeature::deleteAction(causer,x,y);
|
||||
}
|
||||
return false;
|
||||
} /* RubberbandPointCluster::deleteAction */
|
||||
|
||||
} } /* namespace SituationMap::RB */
|
||||
Reference in new issue
Block a user