본문으로 건너뛰기
로딩중...
검색중...
일치하는것 없음
SelectionController.h
1#pragma once
2
3#include "gdkqt/QtGdkExport.h"
4
5#include "editing/selection/SelectionFeatureRef.h"
6#include "editing/selection/SelectionOperation.h"
7#include "gdkqt/GdkQtForward.h"
8#include "gdk_dll/glsTypes.h"
9#include "gdk_dll/maptools/glsMapToolTypes.h"
10
11#include <QPointF>
12#include <QString>
13#include <QVector>
14#include <Qt>
15
16#include <functional>
17#include <memory>
18
19class QStatusBar;
20
21namespace GDK {
22class glsSelectionService;
23class glsSelectionResult;
24}
25
26namespace GdkQt {
27
28class AppSettingsManager;
30
45class QT_GDK_API SelectionController final {
46public:
49
64 GdkMapWidget* mapWidget,
65 SelectionProvider* selectionProvider,
66 AppSettingsManager* settings,
67 QStatusBar* statusBar,
68 std::function<QString()> currentLayerId);
69 // out-of-line 정의(.cpp) — DLL이 소멸자 심볼을 export하도록 보장.
72
83 bool selectByPoint(const QPointF& devicePos, Qt::KeyboardModifiers modifiers);
96 bool selectSingleByPointIfHit(const QPointF& devicePos,
97 Qt::KeyboardModifiers modifiers,
98 QString* outError);
106 GDK::glsMapToolEditTargetResult selectEditTargetByToolRequest(const GDK::glsMapToolSelectionRequest& request);
116 bool selectByPolygon(const QVector<GDK::glsMapPoint>& mapPoints,
117 Qt::KeyboardModifiers modifiers);
126 bool selectByToolRequest(const GDK::glsMapToolSelectionRequest& request);
131 QVector<qint64> selectedFeatureIds(const QString& layerId, QString* outError) const;
135 QVector<SelectedFeatureRef> selectedFeatures(QString* outError) const;
140 int selectedFeatureCount(const QString& layerId, QString* outError) const;
144 bool hasAnySelectedFeature(QString* outError) const;
148 int totalSelectedFeatureCount(QString* outError) const;
154 int selectedFeatureCountExcluding(const QString& layerId, qint64 excludedFid, QString* outError) const;
162 QString selectedLayerId(QString* outError) const;
168 bool clearCurrentSelection(QString* outError);
175 bool ClearSelection(const QString& layerId, QString* outError = nullptr);
182 bool ClearAllSelections(QString* outError = nullptr);
190 bool SelectResults(const QString& layerId, const QVector<qint64>& ids, QString* outError = nullptr);
199 bool zoomToSelection(QString* outError);
206 void notifyExternalSelectionChanged(const QString& layerId, int selectedCount) const;
213 void notifyIfHeatmapLayer(const QString& layerId) const;
221 void setSelectionChangedCallback(std::function<void(const QString&, int)> callback);
229 void setExcludedFeatureCallback(std::function<bool(const QString&, qint64)> callback);
238 void setSingleHitLayerFilter(std::function<bool(const QString&)> filter);
239
240private:
241 bool selectByPolygon(const QVector<GDK::glsMapPoint>& mapPoints,
242 Qt::KeyboardModifiers modifiers,
243 SelectionSpatialOperation operation);
244 struct NativeBridge;
245 using NativeSelectionCall = std::function<GDK::glsStatus(GDK::glsSelectionService&, GDK::glsSelectionResult*)>;
251 bool runNativeSelection(const NativeSelectionCall& call,
252 GDK::glsSelectionResult* result,
253 QString* outError,
254 bool applySingleHitLayerFilter = false);
255 void flushNotifications() const;
256 int selectionRadiusPixels() const;
257 void refreshMap() const;
258 void notifySelectionChanged(const QString& layerId, int selectedCount) const;
259 void reportError(const QString& title, const QString& error) const;
260 void showStatus(const QString& message) const;
261
262 GdkQtSession* m_session = nullptr;
263 GdkMapWidget* m_mapWidget = nullptr;
264 SelectionProvider* m_selectionProvider = nullptr;
265 AppSettingsManager* m_settings = nullptr;
266 QStatusBar* m_statusBar = nullptr;
267 std::function<QString()> m_currentLayerId;
268 std::function<void(const QString&, int)> m_selectionChanged;
269 std::function<bool(const QString&, qint64)> m_excludedFeature;
270 std::function<bool(const QString&)> m_singleHitLayerFilter;
271 std::unique_ptr<NativeBridge> m_bridge;
272};
273
274} // namespace GdkQt
GdkQtSession의 지도를 보여 주는 재사용 가능한 Qt Widgets 지도 위젯입니다.
정의 GdkMapWidget.h:79
워크스페이스를 소유하고 지도와 데이터 작업을 Qt 형식으로 제공하는 세션입니다.
정의 GdkQtSession.h:39
bool selectSingleByPointIfHit(const QPointF &devicePos, Qt::KeyboardModifiers modifiers, QString *outError)
기기 픽셀 위치에서 피처 하나만 골라 선택합니다.
int selectedFeatureCount(const QString &layerId, QString *outError) const
레이어에서 선택된 피처 수를 읽습니다.
void setSelectionChangedCallback(std::function< void(const QString &, int)> callback)
선택이 바뀌었을 때 부를 콜백을 등록합니다.
void setSingleHitLayerFilter(std::function< bool(const QString &)> filter)
selectSingleByPointIfHit()에만 적용되는 후보 레이어 필터를 등록합니다.
bool zoomToSelection(QString *outError)
선택된 피처 전체의 범위에 화면을 맞춥니다.
void notifyIfHeatmapLayer(const QString &layerId) const
레이어가 히트맵 레이어이면 선택이 비었음을 선택 변경 콜백으로 알립니다.
int totalSelectedFeatureCount(QString *outError) const
모든 레이어의 선택된 피처 수 합계를 읽습니다.
QString selectedLayerId(QString *outError) const
선택을 가진 레이어의 ID를 읽습니다.
~SelectionController()
컨트롤러를 없앱니다. 빌린 객체는 건드리지 않습니다.
bool selectByPolygon(const QVector< GDK::glsMapPoint > &mapPoints, Qt::KeyboardModifiers modifiers)
지도 좌표 참조계의 폴리곤(링)으로 피처를 선택합니다.
GDK::glsMapToolEditTargetResult selectEditTargetByToolRequest(const GDK::glsMapToolSelectionRequest &request)
네이티브 편집 도구가 요청한 편집 대상 고르기를 실행합니다.
bool clearCurrentSelection(QString *outError)
모든 레이어의 선택을 해제하는 호환용 진입점입니다.
void setExcludedFeatureCallback(std::function< bool(const QString &, qint64)> callback)
선택에서 제외할 피처를 판정하는 콜백을 등록합니다.
bool SelectResults(const QString &layerId, const QVector< qint64 > &ids, QString *outError=nullptr)
레이어의 선택을 주어진 피처 ID 목록으로 설정합니다.
GdkQt::SelectedFeatureRef SelectedFeatureRef
레이어 ID와 피처 ID로 선택된 피처 하나를 가리키는 GdkQt::SelectedFeatureRef의 별칭입니다.
정의 SelectionController.h:48
bool selectByPoint(const QPointF &devicePos, Qt::KeyboardModifiers modifiers)
기기 픽셀 위치 주변의 피처를 수정 키 규칙에 따라 선택합니다.
bool selectByToolRequest(const GDK::glsMapToolSelectionRequest &request)
네이티브 지도 도구가 만든 선택 요청을 실행합니다.
int selectedFeatureCountExcluding(const QString &layerId, qint64 excludedFid, QString *outError) const
피처 하나를 빼고 센 레이어의 선택된 피처 수를 읽습니다.
void notifyExternalSelectionChanged(const QString &layerId, int selectedCount) const
컨트롤러를 거치지 않고 바뀐 선택을 선택 변경 콜백으로 알립니다.
QVector< SelectedFeatureRef > selectedFeatures(QString *outError) const
모든 레이어의 선택된 피처를 레이어 ID와 피처 ID 쌍으로 읽습니다.
bool hasAnySelectedFeature(QString *outError) const
선택된 피처가 하나라도 있는지 읽습니다.
bool ClearAllSelections(QString *outError=nullptr)
모든 레이어의 선택을 해제합니다.
bool ClearSelection(const QString &layerId, QString *outError=nullptr)
레이어 하나의 선택을 해제합니다.
QVector< qint64 > selectedFeatureIds(const QString &layerId, QString *outError) const
레이어에서 선택된 피처 ID 목록을 읽습니다.
SelectionController(GdkQtSession *session, GdkMapWidget *mapWidget, SelectionProvider *selectionProvider, AppSettingsManager *settings, QStatusBar *statusBar, std::function< QString()> currentLayerId)
컨트롤러를 만듭니다.
GDK::glsSelectionService를 Qt 형식으로 감싼 선택 읽기와 쓰기 창구입니다.
정의 SelectionProvider.h:24
SelectionSpatialOperation
영역 선택에서 피처를 고르는 공간 조건입니다.
정의 SelectionOperation.h:10
glsGdkQt의 공개 형식과 함수가 있는 네임스페이스입니다.
정의 AppSettings.h:15
선택된 피처 하나를 레이어 ID와 피처 ID로 가리키는 값입니다.
정의 SelectionFeatureRef.h:12