Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+193
@@ -0,0 +1,193 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Interface-Implementation of FunctionalArea
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
// Own
|
||||
#include "sound_area_impl.h"
|
||||
#include <MapImpl/map_impl.h>
|
||||
#include <GraphicalObjects/graphical_object_path.h>
|
||||
#include <GraphicalObjects/graphical_object_text.h>
|
||||
#include <GraphicalObjects/graphical_object_picture_marker.h>
|
||||
|
||||
|
||||
// ESRI
|
||||
|
||||
|
||||
// Qt
|
||||
#include <QPainter>
|
||||
|
||||
|
||||
namespace SituationMap
|
||||
{
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class SoundAreaImpl
|
||||
//-----------------------------------------------------------------------------
|
||||
SoundAreaImpl::SoundAreaImpl(const QString &debugInfo)
|
||||
: SoundArea() // Interface
|
||||
, BaseClass(debugInfo) // Implementation
|
||||
, m_logger(getLogger("SoundAreaImpl"))
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
m_markerOrigin.setMapObjectImpl(this);
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
}
|
||||
|
||||
SoundAreaImpl::~SoundAreaImpl()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
delete m_pictureMarker;
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
||||
}
|
||||
|
||||
//void SoundAreaImpl::reRenderSymbol()
|
||||
//{
|
||||
// BaseClass::reRenderSymbol();
|
||||
// if (m_pointSymbol)
|
||||
// m_pointSymbol->reRenderSymbol();
|
||||
//}
|
||||
|
||||
Point3D SoundAreaImpl::markerOrigin() const
|
||||
{
|
||||
return m_markerOrigin.origin();
|
||||
}
|
||||
void SoundAreaImpl::setMarkerOrigin(const Point3D &origin)
|
||||
{
|
||||
m_markerOrigin.setOrigin(origin);
|
||||
}
|
||||
|
||||
const MarkerData &SoundAreaImpl::markerData() const
|
||||
{
|
||||
return m_markerData.value();
|
||||
}
|
||||
void SoundAreaImpl::setMarkerData(const MarkerData &markerData)
|
||||
{
|
||||
m_markerData = markerData;
|
||||
}
|
||||
|
||||
QImage SoundAreaImpl::previewImageTypical() const
|
||||
{
|
||||
return m_markerData.value().m_proxyImage; // maybe mainImage if it will be provided (see geo_image_impl)
|
||||
}
|
||||
|
||||
QImage SoundAreaImpl::previewImageSpecific() const
|
||||
{
|
||||
QImage imageFromForm = BaseClass::previewImageSpecific();
|
||||
QImage markerImage = markerData().proxyImage();
|
||||
|
||||
// most likely bothj are available:
|
||||
if (!imageFromForm.isNull() && !markerImage.isNull())
|
||||
{
|
||||
// merge marker image on top:
|
||||
const QSize &outerSize = imageFromForm.size();
|
||||
markerImage = markerImage.scaled(outerSize/1.5, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
||||
|
||||
QPainter painter(&imageFromForm);
|
||||
painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform);
|
||||
|
||||
QRect r = markerImage.rect();
|
||||
|
||||
int offsetX = (outerSize.width() - r.width()) / 2;
|
||||
int offsetY = (outerSize.height() - r.height()) / 2;
|
||||
|
||||
r.moveTo(offsetX, offsetY);
|
||||
painter.drawImage(r, markerImage, markerImage.rect());
|
||||
return imageFromForm;
|
||||
} else if (imageFromForm.isNull())
|
||||
return markerImage;
|
||||
|
||||
return imageFromForm;
|
||||
}
|
||||
|
||||
|
||||
bool SoundAreaImpl::updateViewImpl()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START"
|
||||
<< " symbol=" << m_symbol.value().sidc
|
||||
<< " visibility=" << m_visibility
|
||||
<< " visiTechn=" << m_visibilityTechnical
|
||||
<< " visiTact=" << m_visibilityTactical;
|
||||
|
||||
bool success = BaseClass::updateViewImpl();
|
||||
|
||||
if (!success)
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " updateViewImpl failed";
|
||||
|
||||
|
||||
if (!updateViewImplMarkerData())
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " updateViewImplPointSymbolData failed";
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END, success=" << success;
|
||||
return success;
|
||||
}
|
||||
|
||||
bool SoundAreaImpl::updateViewImplMarkerData()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
|
||||
if (m_markerData.changed())
|
||||
{
|
||||
const MarkerData &markerData = m_markerData.value();
|
||||
|
||||
// empty?
|
||||
if (markerData.isEmpty())
|
||||
{
|
||||
delete m_pictureMarker;
|
||||
m_pictureMarker = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ok, data available:
|
||||
if (!m_pictureMarker)
|
||||
{
|
||||
m_pictureMarker = new GraphicalObjectPictureMarker(m_mapImpl->getEsriGeoView(),
|
||||
m_graphicsLayer,
|
||||
m_debugInfo + QLatin1String("#Marker"),
|
||||
m_uniqueMapId);
|
||||
}
|
||||
if (markerData.hasMarker())
|
||||
m_pictureMarker->setMarkerSymbol(markerData.m_proxyMarker,
|
||||
markerData.m_proxyMarkerSize,
|
||||
markerData.m_proxyMarkerColor);
|
||||
else if (markerData.hasProxyImage())
|
||||
m_pictureMarker->setImage(markerData.m_proxyImage,
|
||||
markerData.m_proxyImageDefaultSize);
|
||||
} // if (m_markerData.changed())
|
||||
|
||||
m_pictureMarker->setOrigin(m_markerOrigin.originTranslated());
|
||||
|
||||
m_pictureMarker->setPickable(m_mainGraphicalObject->pickable());
|
||||
m_pictureMarker->setSelected(m_mainGraphicalObject->selected());
|
||||
m_pictureMarker->setDrawOrder(m_internalDrawOrder + 1);
|
||||
// m_pictureMarker->setScale();
|
||||
m_pictureMarker->setVisibility(m_visibility && m_visibilityTechnical);
|
||||
|
||||
bool success = m_pictureMarker->updateView();
|
||||
if (!success)
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " updateViewImpl failed, m_debugInfo =" << m_debugInfo;
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END, success=" << success;
|
||||
return success;
|
||||
}
|
||||
|
||||
bool SoundAreaImpl::init(MapImpl *mapImpl, const QString &logicalLayerName)
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
|
||||
bool success = BaseClass::init(mapImpl, logicalLayerName, GraphicalObjectPathType::Polygon);
|
||||
|
||||
setLineStyle(LineStyle(Qt::black, 2));
|
||||
|
||||
if (!success)
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " init failed";
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END, success=" << success;
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
} // namespace SituationMap
|
||||
Reference in new issue
Block a user