Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions lib/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ import 'dart:io';
import 'package:build/build.dart';
import 'package:glob/glob.dart';

const excludedSamples = <String>{
//TODO(4855): re-enable Analysis samples
'show_line_of_sight_between_points',
'show_viewshed_from_geoelement_in_scene',
'show_viewshed_from_point_in_scene',
};
const excludedSamples = <String>{};

// Returns a list of metadata files, excluding the ones in the excludedSamples list.
Future<List<String>> getMetadataFiles(BuildStep buildStep) async {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Show exploratory line of sight between points

Perform an exploratory line of sight analysis between two points in real time.

![Image of show exploratory line of sight between points](show_exploratory_line_of_sight_between_points.png)

## Use case

An exploratory line of sight analysis can be used to assess whether a view is obstructed between an observer and a target. Obstructing features could either be natural, like topography, or man-made, like buildings. Consider an events planning company wanting to commemorate a national event by lighting sequential beacons across hill summits or roof tops. To guarantee a successful event, ensuring an unobstructed line of sight between neighboring beacons would allow each beacon to be activated as intended.

Note: This analysis is a form of "exploratory analysis", which means the results are calculated on the current scale of the data, and the results are generated very quickly but not persisted. If persisted analysis performed at the full resolution of the data is required, consider using a `LineOfSightFunction` to perform a line of sight calculation instead.

## How to use the sample

The sample loads with a preset observer and target location, linked by a colored line. A red segment on the line means the view between observer and target is obstructed, whereas green means the view is unobstructed.

Tap the scene to set the location of the observer. Long press to set the line-of-sight target location.

## How it works

1. Create an `AnalysisOverlay` and add it to the scene view.
2. Create a `ExploratoryLocationLineOfSight` with initial observer and target locations and add it to the analysis overlay.
3. Set `onTap` and `onLongPress` handler functions when creating the `ArcGISSceneView`. Use the `ArcGISSceneViewController.screenToBaseSurface(Offset screenOffset)` function to convert the screen offset to an `ArcGISPoint` on the scene. In the `onTap` function, set the `ExploratoryLocationLineOfSight.observerLocation` property. In the `onLongPress` function, set the `ExploratoryLocationLineOfSight.targetLocation` property.
4. The `AnalysisOverlay` will automatically update when either of the locations are updated.

## Relevant API

* AnalysisOverlay
* ArcGISSceneView
* ExploratoryLocationLineOfSight

## Tags

3D, exploratory line of sight, visibility, visibility analysis
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"category": "Analysis",
"description": "Perform an exploratory line of sight analysis between two points in real time.",
"ignore": false,
"images": [
"show_exploratory_line_of_sight_between_points.png"
],
"keywords": [
"3D",
"exploratory line of sight",
"visibility",
"visibility analysis",
"AnalysisOverlay",
"ArcGISSceneView",
"ExploratoryLocationLineOfSight"
],
"redirect_from": [],
"relevant_apis": [
"AnalysisOverlay",
"ArcGISSceneView",
"ExploratoryLocationLineOfSight"
],
"snippets": [
"show_exploratory_line_of_sight_between_points.dart"
],
"title": "Show exploratory line of sight between points"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ import 'package:arcgis_maps/arcgis_maps.dart';
import 'package:arcgis_maps_sdk_flutter_samples/common/common.dart';
import 'package:flutter/material.dart';

class ShowLineOfSightBetweenPoints extends StatefulWidget {
const ShowLineOfSightBetweenPoints({super.key});
class ShowExploratoryLineOfSightBetweenPoints extends StatefulWidget {
const ShowExploratoryLineOfSightBetweenPoints({super.key});

@override
State<ShowLineOfSightBetweenPoints> createState() =>
_ShowLineOfSightBetweenPointsState();
State<ShowExploratoryLineOfSightBetweenPoints> createState() =>
_ShowExploratoryLineOfSightBetweenPointsState();
}

class _ShowLineOfSightBetweenPointsState
extends State<ShowLineOfSightBetweenPoints>
class _ShowExploratoryLineOfSightBetweenPointsState
extends State<ShowExploratoryLineOfSightBetweenPoints>
with SampleStateSupport {
// Create a controller for the scene view.
final _sceneViewController = ArcGISSceneView.createController();

// The LocationLineOfSight object that will provide line-of-sight analysis for this sample.
// The exploratory line of sight object that will provide the analysis for this sample.
// The object is initialized with the starting observer and target locations.
final _locationLineOfSight = LocationLineOfSight(
final _exploratoryLocationLineOfSight = ExploratoryLocationLineOfSight(
observerLocation: ArcGISPoint(
x: -73.095827750063904,
y: -49.319214695380957,
Expand Down Expand Up @@ -97,9 +97,9 @@ class _ShowLineOfSightBetweenPointsState
final scene = _setupScene();
_sceneViewController.arcGISScene = scene;

// Create an AnalysisOverlay and add the LocationLineOfSight object to it.
// Create an AnalysisOverlay and add the exploratory location line of sight object to it.
final analysisOverlay = AnalysisOverlay();
analysisOverlay.analyses.add(_locationLineOfSight);
analysisOverlay.analyses.add(_exploratoryLocationLineOfSight);

// Add the AnalysisOverlay to the view controller.
_sceneViewController.analysisOverlays.add(analysisOverlay);
Expand All @@ -117,7 +117,7 @@ class _ShowLineOfSightBetweenPointsState
if (newObserverPoint == null) return;

// Set the new origin point on the analysis object.
_locationLineOfSight.observerLocation = newObserverPoint;
_exploratoryLocationLineOfSight.observerLocation = newObserverPoint;
}

void onLongPressEnd(Offset offset) {
Expand All @@ -129,7 +129,7 @@ class _ShowLineOfSightBetweenPointsState
if (newTargetPoint == null) return;

// Set the new origin point on the analysis object.
_locationLineOfSight.targetLocation = newTargetPoint;
_exploratoryLocationLineOfSight.targetLocation = newTargetPoint;
}

ArcGISScene _setupScene() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Show exploratory viewshed from geoelement in scene

Analyze the exploratory viewshed for an object (GeoElement) in a scene.

![Image of show exploratory viewshed from geoelement in scene](show_exploratory_viewshed_from_geoelement_in_scene.png)

## Use case

An exploratory viewshed analysis is a type of visual analysis you can perform on a scene. The exploratory viewshed aims to answer the question 'What can I see from a given location?'. The output is an overlay with two different colors - one representing the visible areas (green) and the other representing the obstructed areas (red).

Note: This analysis is a form of "exploratory analysis", which means the results are calculated on the current scale of the data, and the results are generated very quickly but not persisted. If persisted analysis performed at the full resolution of the data is required, consider using a `ViewshedFunction` to perform a viewshed calculation instead.

## How to use the sample

Tap to set a destination for the vehicle (a GeoElement). The vehicle will 'drive' towards the tapped location. The exploratory viewshed analysis will update as the vehicle moves.

## How it works

1. Create and show the `ArcGISScene`, with an elevation source and a buildings layer.
2. Add a model (the `GeoElement`) to represent the observer (in this case, a tank).
* Use a `SimpleRenderer` which has a heading expression set in the `GraphicsOverlay`. This way you can relate the viewshed's heading to the `GeoElement` object's heading.
3. Create an `ExploratoryGeoElementViewshed` with configuration for the viewshed analysis.
4. Add the viewshed to an `AnalysisOverlay` and add the overlay to the scene.
5. Configure the SceneView `CameraController` to orbit the vehicle.

## Relevant API

* AnalysisOverlay
* ExploratoryGeoElementViewshed
* GeodeticDistanceResult
* GeometryEngine.distanceGeodetic
* GeometryEngine.moveGeodetic
* ModelSceneSymbol
* OrbitGeoElementCameraController

## Offline data

[Model Marker Symbol Data](https://www.arcgis.com/home/item.html?id=07d62a792ab6496d9b772a24efea45d0)

## About the data

This sample shows a [Buildings in Brest, France Scene](https://www.arcgis.com/home/item.html?id=b343e14455fe45b98a2c20ebbceec0b0) from ArcGIS Online. The sample uses a [Tank model scene symbol](http://www.arcgis.com/home/item.html?id=07d62a792ab6496d9b772a24efea45d0) hosted as an item on ArcGIS Online.

## Tags

3D, analysis, buildings, exploratory viewshed, model, scene, visibility analysis
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"category": "Analysis",
"description": "Analyze the viewshed for an object (GeoElement) in a scene.",
"description": "Analyze the exploratory viewshed for an object (GeoElement) in a scene.",
"ignore": false,
"images": [
"show_viewshed_from_geoelement_in_scene.png"
"show_exploratory_viewshed_from_geoelement_in_scene.png"
],
"keywords": [
"3D",
"analysis",
"buildings",
"exploratory viewshed",
"model",
"scene",
"viewshed",
"visibility analysis",
"AnalysisOverlay",
"GeoElementViewshed",
"ExploratoryGeoElementViewshed",
"GeodeticDistanceResult",
"GeometryEngine.distanceGeodetic",
"GeometryEngine.moveGeodetic",
Expand All @@ -29,15 +29,15 @@
"redirect_from": [],
"relevant_apis": [
"AnalysisOverlay",
"GeoElementViewshed",
"ExploratoryGeoElementViewshed",
"GeodeticDistanceResult",
"GeometryEngine.distanceGeodetic",
"GeometryEngine.moveGeodetic",
"ModelSceneSymbol",
"OrbitGeoElementCameraController"
],
"snippets": [
"show_viewshed_from_geoelement_in_scene.dart"
"show_exploratory_viewshed_from_geoelement_in_scene.dart"
],
"title": "Show viewshed from geoelement in scene"
"title": "Show exploratory viewshed from geoelement in scene"
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ import 'package:arcgis_maps_sdk_flutter_samples/common/common.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

class ShowViewshedFromGeoelementInScene extends StatefulWidget {
const ShowViewshedFromGeoelementInScene({super.key});
class ShowExploratoryViewshedFromGeoelementInScene extends StatefulWidget {
const ShowExploratoryViewshedFromGeoelementInScene({super.key});

@override
State<ShowViewshedFromGeoelementInScene> createState() =>
_ShowViewshedFromGeoelementInSceneState();
State<ShowExploratoryViewshedFromGeoelementInScene> createState() =>
_ShowExploratoryViewshedFromGeoelementInSceneState();
}

class _ShowViewshedFromGeoelementInSceneState
extends State<ShowViewshedFromGeoelementInScene>
class _ShowExploratoryViewshedFromGeoelementInSceneState
extends State<ShowExploratoryViewshedFromGeoelementInScene>
with SampleStateSupport {
// Create a controller for the scene view.
final _sceneViewController = ArcGISSceneView.createController();
Expand Down Expand Up @@ -100,8 +100,8 @@ class _ShowViewshedFromGeoelementInSceneState
// Set up the orbit camera controller to follow the tank.
_setupCameraController(_tankGraphic!);

// Add the viewshed to the scene.
_addViewshedToScene(_tankGraphic!);
// Add the exploratory viewshed to the scene.
_addExploratoryViewshedToScene(_tankGraphic!);

setState(() => _ready = true);
}
Expand Down Expand Up @@ -253,11 +253,11 @@ class _ShowViewshedFromGeoelementInSceneState
_sceneViewController.graphicsOverlays.add(graphicsOverlay);
}

// Add viewshed to the scene.
void _addViewshedToScene(Graphic tankGraphic) {
// Create a GeoElementViewshed attached to the scene.
final geoElementViewshed =
GeoElementViewshed(
// Add exploratory viewshed to the scene.
void _addExploratoryViewshedToScene(Graphic tankGraphic) {
// Create an exploratory geoelement viewshed attached to the scene.
final exploratoryGeoElementViewshed =
ExploratoryGeoElementViewshed(
geoElement: tankGraphic,
horizontalAngle: 90,
verticalAngle: 40,
Expand All @@ -270,8 +270,9 @@ class _ShowViewshedFromGeoelementInSceneState
..offsetZ = 0.5
..offsetY = 4;

// Create an Analysis Overlay and add the viewshed to it.
final analysisOverlay = AnalysisOverlay()..analyses.add(geoElementViewshed);
// Create an Analysis Overlay and add the exploratory viewshed to it.
final analysisOverlay = AnalysisOverlay()
..analyses.add(exploratoryGeoElementViewshed);

// Add the analysis overlay to the scene view.
_sceneViewController.analysisOverlays.add(analysisOverlay);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Show exploratory viewshed from point in scene

Perform an exploratory viewshed analysis from a defined vantage point.

![Image of show exploratory viewshed from point in scene](show_exploratory_viewshed_from_point_in_scene.png)

## Use case

An exploratory viewshed analysis is a type of visual analysis you can perform on a scene. The exploratory viewshed shows what can be seen from a given location. The output is an overlay with two different colors - one representing the visible areas (green) and the other representing the obstructed areas (red).

Note: This analysis is a form of "exploratory analysis", which means the results are calculated on the current scale of the data, and the results are generated very quickly but not persisted. If persisted analysis performed at the full resolution of the data is required, consider using a `ViewshedFunction` to perform a viewshed calculation instead.

## How to use the sample

Tap a location on the map to change the location of the exploratory viewshed observation point.

Tap the "Settings" button at the bottom of the screen to show the controls to change the exploratory viewshed settings. The rendered exploratory viewshed will update in real time as the values are adjusted.

## How it works

1. Create an `ExploratoryLocationViewshed` passing in the observer location, heading, pitch, horizontal/vertical angles, and min/max distances.
2. Set the property values on the viewshed instance for location, direction, range, and visibility properties.

## Relevant API

* AnalysisOverlay
* ArcGISSceneLayer
* ArcGISTiledElevationSource
* ExploratoryLocationViewshed
* ExploratoryViewshed

## About the data

The scene shows a [buildings layer in Brest, France](https://www.arcgis.com/home/item.html?id=b343e14455fe45b98a2c20ebbceec0b0) hosted on ArcGIS Online.

## Tags

3D, exploratory viewshed, frustum, scene, visibility analysis
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
"category": "Analysis",
"description": "Perform a viewshed analysis from a defined vantage point.",
"description": "Perform an exploratory viewshed analysis from a defined vantage point.",
"ignore": false,
"images": [
"show_viewshed_from_point_in_scene.png"
"show_exploratory_viewshed_from_point_in_scene.png"
],
"keywords": [
"3D",
"exploratory viewshed",
"frustum",
"scene",
"viewshed",
"visibility analysis",
"AnalysisOverlay",
"ArcGISSceneLayer",
"ArcGISTiledElevationSource",
"LocationViewshed",
"Viewshed"
"ExploratoryLocationViewshed",
"ExploratoryViewshed"
],
"redirect_from": [],
"relevant_apis": [
"AnalysisOverlay",
"ArcGISSceneLayer",
"ArcGISTiledElevationSource",
"LocationViewshed",
"Viewshed"
"ExploratoryLocationViewshed",
"ExploratoryViewshed"
],
"snippets": [
"show_viewshed_from_point_in_scene.dart"
"show_exploratory_viewshed_from_point_in_scene.dart"
],
"title": "Show viewshed from point in scene"
"title": "Show exploratory viewshed from point in scene"
}
Loading
Loading