Skip to content

Commit

Permalink
changes other than list model related comments
Browse files Browse the repository at this point in the history
  • Loading branch information
har13205 committed May 22, 2024
1 parent 8635a05 commit e81421c
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// [WriteFile Name=CreateAndEditGeometries, Category=Geometry]
// [WriteFile Name=SnapGeometryEdits, Category=EditData]
// [Legal]
// Copyright 2023 Esri.
// Copyright 2024 Esri.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ Snapping is used to maintain data integrity between different sources of data wh

To snap to polygon and polyline layers, the recommended approach is to set the `FeatureLayer`'s feature tiling mode to `FeatureTilingMode.enabledWithFullResolutionWhenSupported` and use the default `ServiceFeatureTable` feature request mode `FeatureRequestMode.onInteractionCache`. Local data sources, such as geodatabases, always provide full resolution geometries. Point and multipoint feature layers are also always full resolution.

For SDKs which added enhanced feedback at 200.3 (Java, QT, .NET, Swift): Snapping can be used during interactive edits that move existing vertices using the `VertexTool`. It is also supported for adding new vertices for input devices with a hover event (such as a mouse move without a mouse button press). Using the magnifier to perform a vertex move allows users of touch devices to clearly see the visual cues for snapping.

For SDKs which did not add enhanced feedback yet (Kotlin): Snapping can be used during interactive edits that move existing vertices using the `VertexTool`. Using the magnifier to perform the vertex move allows users of touch devices to clearly see the visual cues for snapping.
Snapping can be used during interactive edits that move existing vertices using the `VertexTool`. It is also supported for adding new vertices for input devices with a hover event (such as a mouse move without a mouse button press). Using the magnifier to perform a vertex move allows users of touch devices to clearly see the visual cues for snapping.

## Tags

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,17 @@ void SnapGeometryEdits::createConnections()
m_geometryEditor->start(m_editingGraphic->geometry());

emit geometryEditorStartedChanged();

result->deleteLater();
});
}
emit canUndoChanged();
emit elementIsSelectedChanged();
emit isElementSelectedChanged();
});

// Enable or disable buttons when mouse is released (ie after a drag operation)
connect(m_mapView, &MapQuickView::mouseReleased, this, [this](const QMouseEvent&)
{
emit canUndoChanged();
emit elementIsSelectedChanged();
emit isElementSelectedChanged();
});
}

Expand All @@ -173,7 +171,7 @@ bool SnapGeometryEdits::canUndo()
return (m_geometryEditor && m_geometryEditor->canUndo());
}

bool SnapGeometryEdits::elementIsSelected()
bool SnapGeometryEdits::isElementSelected()
{
return (m_geometryEditor && m_geometryEditor->selectedElement() && m_geometryEditor->selectedElement()->canDelete());
}
Expand All @@ -189,15 +187,13 @@ void SnapGeometryEdits::pointSourceEnabledStatus(bool snappingCheckedState, int
{
m_pointSourceCheckedState[index] = snappingCheckedState;
m_pointSourceList[index]->setEnabled(m_pointSourceCheckedState[index]);

}

// Toggles snapping for the polyline layer snap source at [index] using the checked value from the snap settings
void SnapGeometryEdits::polylineSourceEnabledStatus(bool snappingCheckedState, int index)
{
m_polylineSourceCheckedState[index] = snappingCheckedState;
m_polylineSourceList[index]->setEnabled(m_polylineSourceCheckedState[index]);

}

// Enable snapping for all the point layer snap sources
Expand Down Expand Up @@ -247,46 +243,50 @@ void SnapGeometryEdits::startEditor(GeometryEditorMode geometryEditorMode)
emit geometryEditorStartedChanged();
}

// Stops the GeometryEditor and append the new graphic to the graphics overlay
void SnapGeometryEdits::stopEditor()
Symbol* SnapGeometryEdits::determineGeometrySymbol(const Geometry& geometry)
{
const Geometry geometry = m_geometryEditor->stop();
emit geometryEditorStartedChanged();

if (m_editingGraphic)
{
m_editingGraphic->setGeometry(geometry);

m_editingGraphic->setVisible(true);
m_editingGraphic = nullptr;

return;
}

Symbol* geometrySymbol = nullptr;
switch (geometry.geometryType())
{
case GeometryType::Point:
geometrySymbol = m_pointSymbol;
break;

case GeometryType::Multipoint:
geometrySymbol = m_multiPointSymbol;
break;

case GeometryType::Polyline:
geometrySymbol = m_lineSymbol;
break;

case GeometryType::Polygon:
geometrySymbol = m_polygonSymbol;
break;

default:
break;
}
return geometrySymbol;
}

// Stops the GeometryEditor and append the new graphic to the graphics overlay
void SnapGeometryEdits::stopEditing()
{
const Geometry geometry = m_geometryEditor->stop();
emit geometryEditorStartedChanged();

if (m_editingGraphic)
{
m_editingGraphic->setGeometry(geometry);

m_editingGraphic->setVisible(true);
m_editingGraphic = nullptr;

return;
}

m_graphicsOverlay->graphics()->append(new Graphic(geometry, geometrySymbol, new QObject(this)));
Symbol* geometrySymbol = determineGeometrySymbol(geometry);
if (geometrySymbol)
{
m_graphicsOverlay->graphics()->append(new Graphic(geometry, geometrySymbol, this));
}
}

// Deletes the selected element
Expand All @@ -306,7 +306,7 @@ void SnapGeometryEdits::editorUndo()
void SnapGeometryEdits::displaySnapSources()
{
// create lists for displaying the snap sources in snap settings
QList<Esri::ArcGISRuntime::SnapSourceSettings*> snapSourceList;
QList<SnapSourceSettings*> snapSourceList;
if (m_geometryEditor->snapSettings()->sourceSettings().empty())
{
m_geometryEditor->snapSettings()->syncSourceSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ class SnapGeometryEdits : public QObject
Q_PROPERTY(Esri::ArcGISRuntime::MapQuickView* mapView READ mapView WRITE setMapView NOTIFY mapViewChanged)
Q_PROPERTY(bool geometryEditorStarted READ geometryEditorStarted NOTIFY geometryEditorStartedChanged)
Q_PROPERTY(bool canUndo READ canUndo NOTIFY canUndoChanged)
Q_PROPERTY(bool elementIsSelected READ elementIsSelected NOTIFY elementIsSelectedChanged)
Q_PROPERTY(bool isElementSelected READ isElementSelected NOTIFY isElementSelectedChanged)
Q_PROPERTY(bool layersLoaded MEMBER m_layersLoaded NOTIFY layersLoadedChanged)
Q_PROPERTY(QList<QString> pointLayers MEMBER m_pointLayers NOTIFY pointLayersChanged)
Q_PROPERTY(QList<QString> polylineLayers MEMBER m_polylineLayers NOTIFY polylineLayersChanged)
Q_PROPERTY(QStringList pointLayers MEMBER m_pointLayers NOTIFY pointLayersChanged)
Q_PROPERTY(QStringList polylineLayers MEMBER m_polylineLayers NOTIFY polylineLayersChanged)
Q_PROPERTY(QList<bool> pointSourceCheckedState MEMBER m_pointSourceCheckedState NOTIFY pointSourceCheckedStateChanged)
Q_PROPERTY(QList<bool> polylineSourceCheckedState MEMBER m_polylineSourceCheckedState NOTIFY polylineSourceCheckedStateChanged)

Expand All @@ -65,7 +65,7 @@ class SnapGeometryEdits : public QObject

static void init();
Q_INVOKABLE void startEditor(GeometryEditorMode geometryEditorMode);
Q_INVOKABLE void stopEditor();
Q_INVOKABLE void stopEditing();
Q_INVOKABLE void deleteSelection();
Q_INVOKABLE void editorUndo();
Q_INVOKABLE void snappingEnabledStatus(bool checkedValue);
Expand All @@ -77,7 +77,7 @@ class SnapGeometryEdits : public QObject

signals:
void canUndoChanged();
void elementIsSelectedChanged();
void isElementSelectedChanged();
void geometryEditorStartedChanged();
void layersLoadedChanged();
void mapViewChanged();
Expand All @@ -93,7 +93,8 @@ class SnapGeometryEdits : public QObject
bool canUndo();
void createInitialSymbols();
void createConnections();
bool elementIsSelected();
bool isElementSelected();
Esri::ArcGISRuntime::Symbol* determineGeometrySymbol(const Esri::ArcGISRuntime::Geometry& geometry);



Expand All @@ -112,7 +113,7 @@ class SnapGeometryEdits : public QObject
QList<Esri::ArcGISRuntime::SnapSourceSettings*> m_polylineSourceList;
QList<QString> m_pointLayers;
QList<QString> m_polylineLayers;
bool m_layersLoaded;
bool m_layersLoaded = false;
};

#endif // SNAPGEOMETRYEDITS_H
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,3 @@ android {
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
}
android: include(/Users/har13205/Library/Android/sdk/android_openssl/openssl.pri)
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Item {
id: deleteButton
buttonName: qsTr("Delete")
iconPath: "qrc:/Samples/EditData/SnapGeometryEdits/iconAssets/erase-32.png"
enabled: snapGeometryEditsSampleModel.geometryEditorStarted || snapGeometryEditsSampleModel.elementIsSelected
enabled: snapGeometryEditsSampleModel.geometryEditorStarted || snapGeometryEditsSampleModel.isElementSelected
onClicked: snapGeometryEditsSampleModel.deleteSelection();
}

Expand All @@ -152,7 +152,7 @@ Item {
iconPath: "qrc:/Samples/EditData/SnapGeometryEdits/iconAssets/save-32.png"
Layout.columnSpan: 2
enabled: snapGeometryEditsSampleModel.geometryEditorStarted
onClicked: snapGeometryEditsSampleModel.stopEditor();
onClicked: snapGeometryEditsSampleModel.stopEditing();
}

GeometryEditorButton {
Expand Down Expand Up @@ -353,7 +353,7 @@ Item {
}

Item {
height: pointLayersColumn.height+20
height: pointLayersColumn.height+25
}

Column {
Expand Down

0 comments on commit e81421c

Please sign in to comment.