[seiscomp, scanloc] Install, add .gitignore
This commit is contained in:
65
include/seiscomp/gui/map/layers/annotationlayer.h
Normal file
65
include/seiscomp/gui/map/layers/annotationlayer.h
Normal file
@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_GUI_MAP_LAYERS_ANNOTATION_LAYER_H__
|
||||
#define SEISCOMP_GUI_MAP_LAYERS_ANNOTATION_LAYER_H__
|
||||
|
||||
|
||||
#include <seiscomp/gui/map/annotations.h>
|
||||
#include <seiscomp/gui/map/layer.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace Gui {
|
||||
namespace Map {
|
||||
|
||||
|
||||
class Canvas;
|
||||
|
||||
|
||||
class AnnotationLayer : public Layer {
|
||||
public:
|
||||
AnnotationLayer(QObject* parent = nullptr,
|
||||
Annotations *annotations = nullptr);
|
||||
|
||||
void setAnnotations(Annotations *annotations) {
|
||||
_annotations = annotations;
|
||||
}
|
||||
|
||||
Annotations *annotations() const {
|
||||
return _annotations;
|
||||
}
|
||||
|
||||
void draw(const Seiscomp::Gui::Map::Canvas*, QPainter &painter);
|
||||
|
||||
private:
|
||||
typedef QList<QRect> Row;
|
||||
typedef QVector<Row> Grid;
|
||||
|
||||
Annotations *_annotations;
|
||||
};
|
||||
|
||||
|
||||
} // ns Map
|
||||
} // ns Gui
|
||||
} // ns Seiscomp
|
||||
|
||||
|
||||
#endif
|
68
include/seiscomp/gui/map/layers/citieslayer.h
Normal file
68
include/seiscomp/gui/map/layers/citieslayer.h
Normal file
@ -0,0 +1,68 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_GUI_MAP_LAYERS_CITIESLAYER_H
|
||||
#define SEISCOMP_GUI_MAP_LAYERS_CITIESLAYER_H
|
||||
|
||||
|
||||
#include <seiscomp/gui/qt.h>
|
||||
#include <seiscomp/gui/map/layer.h>
|
||||
#include <seiscomp/math/coord.h>
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace Gui {
|
||||
namespace Map {
|
||||
|
||||
|
||||
class Canvas;
|
||||
class Projection;
|
||||
|
||||
|
||||
class SC_GUI_API CitiesLayer : public Layer {
|
||||
public:
|
||||
CitiesLayer(QObject* = nullptr);
|
||||
virtual ~CitiesLayer();
|
||||
|
||||
virtual void init(const Config::Config&);
|
||||
virtual void draw(const Canvas*, QPainter&);
|
||||
|
||||
void setSelectedCity(const Math::Geo::CityD*);
|
||||
const Math::Geo::CityD* selectedCity() const;
|
||||
|
||||
private:
|
||||
typedef QList<QRect> Row;
|
||||
typedef QVector<Row> Grid;
|
||||
|
||||
private:
|
||||
bool drawCity(QPainter&, Grid&, QFont&, bool&, bool&,
|
||||
const Projection*, const Math::Geo::CityD&,
|
||||
const QFontMetrics&, int, int);
|
||||
|
||||
private:
|
||||
const Math::Geo::CityD *_selectedCity;
|
||||
int _topPopulatedPlaces;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Map
|
||||
} // namespce Gui
|
||||
} // namespace Seiscomp
|
||||
|
||||
#endif
|
202
include/seiscomp/gui/map/layers/geofeaturelayer.h
Normal file
202
include/seiscomp/gui/map/layers/geofeaturelayer.h
Normal file
@ -0,0 +1,202 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_GUI_MAP_LAYERS_GEOFEATURELAYER_H
|
||||
#define SEISCOMP_GUI_MAP_LAYERS_GEOFEATURELAYER_H
|
||||
|
||||
|
||||
#include <seiscomp/gui/map/layer.h>
|
||||
#ifndef Q_MOC_RUN
|
||||
#include <seiscomp/geo/featureset.h>
|
||||
#include <seiscomp/geo/index/quadtree.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <QImage>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace Gui {
|
||||
namespace Map {
|
||||
|
||||
|
||||
class Canvas;
|
||||
|
||||
|
||||
class SC_GUI_API GeoFeatureLayer : public Layer,
|
||||
virtual public Geo::GeoFeatureSetObserver {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
GeoFeatureLayer(QObject *parent = nullptr);
|
||||
virtual ~GeoFeatureLayer();
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Returns a feature under the given coordinate.
|
||||
* @param coord The coordinate.
|
||||
* @return A pointer to the feature instance or nullptr. Do not delete
|
||||
* the feature, its ownership is still at the global
|
||||
* GeoFeatureSet.
|
||||
*/
|
||||
const Geo::GeoFeature *findFeature(const Geo::GeoCoordinate &coord) const;
|
||||
|
||||
/**
|
||||
* @brief Convenience function for @findFeature(const Geo::GeoCoordinate &coord).
|
||||
* @param lat The latitude of the coordinate
|
||||
* @param lon The longitude of the coordinate
|
||||
* @return See @findFeature(const Geo::GeoCoordinate &coord).
|
||||
*/
|
||||
const Geo::GeoFeature *findFeature(qreal lat, qreal lon) const;
|
||||
|
||||
/**
|
||||
* @brief Renders the geofeatures on a given canvas with a given
|
||||
* painter. This function is called from bufferUpdated.
|
||||
* @param canvas The target canvas
|
||||
* @param painter The painter to paint with
|
||||
*/
|
||||
void renderFeatures(Canvas *canvas, QPainter &painter);
|
||||
|
||||
virtual void setVisible(bool flag);
|
||||
virtual void bufferUpdated(Canvas *canvas, QPainter &painter);
|
||||
|
||||
virtual QMenu *menu(QMenu*) const;
|
||||
|
||||
virtual void geoFeatureSetUpdated();
|
||||
|
||||
|
||||
private slots:
|
||||
void toggleFeatureVisibility(bool);
|
||||
void disableFeatureVisibility();
|
||||
void showFeatures();
|
||||
void hideFeatures();
|
||||
void reloadFeatures();
|
||||
|
||||
|
||||
private:
|
||||
void initLayerProperites();
|
||||
|
||||
|
||||
private:
|
||||
struct SC_GUI_API LayerProperties {
|
||||
enum SymbolShape {
|
||||
Disabled,
|
||||
None,
|
||||
Circle,
|
||||
Triangle,
|
||||
Square,
|
||||
Diamond
|
||||
};
|
||||
|
||||
const LayerProperties *parent{nullptr};
|
||||
std::string name;
|
||||
std::string title;
|
||||
Qt::Orientation orientation{Qt::Vertical};
|
||||
Qt::Alignment legendArea{Qt::AlignTop | Qt::AlignLeft};
|
||||
QPainter::CompositionMode compositionMode{QPainter::CompositionMode_SourceOver};
|
||||
std::string label;
|
||||
int index{0};
|
||||
bool visible{true};
|
||||
QPen pen;
|
||||
QBrush brush;
|
||||
QFont font;
|
||||
bool drawName{false};
|
||||
bool debug{false};
|
||||
int rank{-1};
|
||||
int roughness{-1};
|
||||
bool filled{false};
|
||||
int symbolSize{8};
|
||||
QImage symbolIcon;
|
||||
QPoint symbolIconHotspot;
|
||||
SymbolShape symbolShape{Disabled};
|
||||
QPolygon symbolPolygon;
|
||||
Qt::Alignment symbolNameAlignment{Qt::AlignTop | Qt::AlignHCenter};
|
||||
int symbolNameMargin{3};
|
||||
|
||||
// derived members
|
||||
QRect symbolRect;
|
||||
|
||||
LayerProperties(const std::string &name) : name(name) {}
|
||||
LayerProperties(const std::string &name,
|
||||
const LayerProperties *parent) {
|
||||
*this = *parent;
|
||||
this->name = name;
|
||||
this->parent = parent;
|
||||
this->title = std::string(); // Reset the legend title
|
||||
}
|
||||
|
||||
bool isChild(const LayerProperties* child) const;
|
||||
void read(const std::string &dataDir = "");
|
||||
|
||||
static SymbolShape getSymbolShape(const std::string &type);
|
||||
};
|
||||
|
||||
|
||||
struct CategoryNode {
|
||||
CategoryNode(const Geo::Category*);
|
||||
~CategoryNode();
|
||||
|
||||
CategoryNode *nodeForCategory(const Geo::Category *cat);
|
||||
CategoryNode *nodeForProperties(const LayerProperties *props);
|
||||
|
||||
const Geo::Category *category;
|
||||
LayerProperties *properties{nullptr};
|
||||
std::vector<CategoryNode*> childs;
|
||||
std::vector<CategoryNode*> childsByName;
|
||||
Geo::QuadTree quadtree;
|
||||
Geo::GeoBoundingBox bbox;
|
||||
};
|
||||
|
||||
static bool compareByIndex(const LayerProperties *p1,
|
||||
const LayerProperties *p2);
|
||||
|
||||
static bool compareNodeByIndex(const GeoFeatureLayer::CategoryNode *n1,
|
||||
const GeoFeatureLayer::CategoryNode *n2);
|
||||
static bool compareNodeByName(const GeoFeatureLayer::CategoryNode *n1,
|
||||
const GeoFeatureLayer::CategoryNode *n2);
|
||||
|
||||
CategoryNode *createOrGetNodeForCategory(const Geo::Category *cat);
|
||||
void buildLegends(CategoryNode *node);
|
||||
QMenu *buildMenu(CategoryNode *node, QMenu *parentMenu) const;
|
||||
void collectLegendItems(CategoryNode *node, QVector<LayerProperties*> &items);
|
||||
void orderTree(CategoryNode *node);
|
||||
void updateBbox(CategoryNode *node);
|
||||
const Geo::GeoFeature *findFeature(CategoryNode *node,
|
||||
const Geo::GeoCoordinate &coord) const;
|
||||
bool toggleVisibility(CategoryNode *node, bool visible);
|
||||
void drawFeatures(CategoryNode *node, Canvas *canvas,
|
||||
QPainter &painter, const QPen &debugPen);
|
||||
bool drawFeature(Canvas *canvas, QPainter *painter,
|
||||
const QPen *debugPen, const LayerProperties *props,
|
||||
const Geo::GeoFeature *f);
|
||||
|
||||
bool _initialized;
|
||||
CategoryNode *_root;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
56
include/seiscomp/gui/map/layers/gridlayer.h
Normal file
56
include/seiscomp/gui/map/layers/gridlayer.h
Normal file
@ -0,0 +1,56 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_GUI_MAP_LAYERS_GRIDLAYER_H
|
||||
#define SEISCOMP_GUI_MAP_LAYERS_GRIDLAYER_H
|
||||
|
||||
|
||||
#include <seiscomp/gui/qt.h>
|
||||
#include <seiscomp/gui/map/layer.h>
|
||||
#include <seiscomp/math/coord.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace Gui {
|
||||
namespace Map {
|
||||
|
||||
|
||||
class Canvas;
|
||||
|
||||
|
||||
class SC_GUI_API GridLayer : public Layer {
|
||||
public:
|
||||
GridLayer(QObject* = nullptr);
|
||||
virtual ~GridLayer();
|
||||
|
||||
virtual void draw(const Canvas*, QPainter&);
|
||||
|
||||
void setGridDistance(const QPointF&);
|
||||
const QPointF& gridDistance() const;
|
||||
private:
|
||||
QPointF _gridDistance;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Map
|
||||
} // namespce Gui
|
||||
} // namespace Seiscomp
|
||||
|
||||
#endif
|
108
include/seiscomp/gui/map/layers/symbollayer.h
Normal file
108
include/seiscomp/gui/map/layers/symbollayer.h
Normal file
@ -0,0 +1,108 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_GUI_MAP_LAYERS_SYMBOLLAYER_H
|
||||
#define SEISCOMP_GUI_MAP_LAYERS_SYMBOLLAYER_H
|
||||
|
||||
|
||||
#include <seiscomp/gui/map/layer.h>
|
||||
#include <seiscomp/gui/map/mapsymbol.h>
|
||||
#include <QList>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace Gui {
|
||||
namespace Map {
|
||||
|
||||
|
||||
class SC_GUI_API SymbolLayer : public Layer {
|
||||
// ----------------------------------------------------------------------
|
||||
// Types
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
typedef QList<Symbol*> Symbols;
|
||||
typedef Symbols::iterator iterator;
|
||||
typedef Symbols::const_iterator const_iterator;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
SymbolLayer(QObject* parent = nullptr);
|
||||
//! D'tor
|
||||
~SymbolLayer();
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* @brief Adds a symbol to the layer.
|
||||
* @param symbol The symbol instance. Ownership is transferred to
|
||||
* the layer
|
||||
* @return Success flag
|
||||
*/
|
||||
bool add(Symbol *symbol);
|
||||
Symbols::const_iterator remove(Symbol *symbol);
|
||||
|
||||
void clear();
|
||||
|
||||
Symbols::size_type count() const;
|
||||
|
||||
bool bringToTop(Symbol *drawable);
|
||||
bool sendToBack(Symbol *drawable);
|
||||
|
||||
void setTop(Symbol *topDrawable);
|
||||
Symbol *top() const;
|
||||
|
||||
Symbols::iterator begin();
|
||||
Symbols::iterator end();
|
||||
|
||||
Symbols::const_iterator begin() const;
|
||||
Symbols::const_iterator end() const;
|
||||
|
||||
void sortByLatitude();
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Layer interface
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
virtual void setVisible(bool);
|
||||
virtual void calculateMapPosition(const Canvas *canvas);
|
||||
virtual bool isInside(const QMouseEvent *event, const QPointF &geoPos);
|
||||
virtual void draw(const Canvas *canvas, QPainter &p);
|
||||
|
||||
|
||||
private:
|
||||
Symbols _symbols;
|
||||
Symbol *_topSymbol;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Map
|
||||
} // namespace Gui
|
||||
} // namespace Seiscomp
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user