コード例 #1
0
 public QueryHelper(OpsDashboard.MapWidget mapWidget, IList<OpsDashboard.DataSource> dataSources, IEnumerable<Graphic> sourceFeatures)
 {
   //A geometry service contains utility methods that provide access to sophisticated and frequently used geometric operations
   //such as buffer, calculate areas and lengths for geometry etc 
   geometryService = new GeometryService("http://sampleserver6.arcgisonline.com/ArcGIS/rest/services/Utilities/Geometry/GeometryServer");
   MapWidget = mapWidget;
   SourceFeatures = sourceFeatures;
   TargetDataSources = dataSources;
 }
        public SelectByLocationToolbar(OpsDashboard.MapWidget mapWidget, IList<OpsDashboard.DataSource> DataSources, FeatureLayer sourceLayer)
        {
            InitializeComponent();

              MapWidget = mapWidget;
              TargetDataSources = DataSources;
              SourceLayer = sourceLayer;

              DataContext = this;
        }
コード例 #3
0
        public GeoFenceViewModel(OD.DataSource dataSource)
            : base(dataSource)
        {
            // init the data members with default values
              TrackIdFieldName  = "GeoFenceId";
              NameFieldName     = "Name";
              CategoryFieldName = "Category";
              ActiveFieldName   = "Active";
              Properties["GeometryServiceUrl"]    = @"http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer";
              Properties["ServiceAreaServiceUrl"] = @"http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Service%20Area";

              // init the commands
              ToggleActiveCommand = new DelegatingCommand(OnToggleActive);
        }
コード例 #4
0
    public StopViewModel(OD.DataSource dataSource, OD.DataSource routesDataSource, StopWidget view)
      : base(dataSource)
    {
      // init _wsTimer
      _webSocketKeepAliveTimer = new DispatcherTimer();
      _webSocketKeepAliveTimer.Interval = new TimeSpan(0, 0, 2);
      _webSocketKeepAliveTimer.Tick += new EventHandler(OnWebSocketKeepAliveTick);

      // init _progressDialogTimer
      _progressDialogTimer = new DispatcherTimer();
      _progressDialogTimer.Tick += new EventHandler(OnProgressDialogTimeOut);

      // init the data members with default values
      StopsRouteNameFieldName   = @"RouteName";
      RoutesRouteNameFieldName  = @"Route";
      Properties["GepHostName"]   = @"localhost";
      Properties["GepHttpPort"]   = @"6180";
      Properties["GepHttpsPort"]  = @"6143";
      Properties["GEP_LOAD_PLAN_ENDPOINT"]          = @"geoevent/rest/receiver/route-command-in";
      Properties["GEP_ROUTES_CALCULATE_ENDPOINT"]   = @"geoevent/rest/receiver/route-update-in";
      Properties["GEP_ROUTES_UPDATE_ENDPOINT"]      = @"geoevent/rest/receiver/route-update-in";
      Properties["GEP_DISPATCH_ENDPOINT"]           = @"geoevent/rest/receiver/route-message-in";
      Properties["STOPS_ROUTE_NAME_FIELD_NAME"]     = @"RouteName";
      Properties["ROUTES_ROUTE_NAME_FIELD_NAME"]    = @"RouteName";
      Properties["ROUTES_UN_ASSIGNED_ROUTE_NAME"]   = @"__Unassigned__";

      _unassignedRouteName = GetPropValue("ROUTES_UN_ASSIGNED_ROUTE_NAME");
      SetRouteDataSource(routesDataSource);

      // temp
      _view = view;

      // init commands
      DispatchCommand = new DelegatingCommand(OnDispatch);
      DispatchAllCommand = new DelegatingCommand(OnDispatchAll);
      UnassignCommand = new DelegatingCommand(OnUnassign);
      CutCommand = new DelegatingCommand(OnCut);
      PasteCommand = new DelegatingCommand(OnPaste);
      PasteOnGroupCommand = new DelegatingCommand(OnPasteOnGroup);

      _edits = new HashSet<string>();

      // Web Socket Event Handlers
      _wsOnOpenEH     = new EventHandler(WebSocket_OnOpen);
      _wsOnCloseEH    = new EventHandler<CloseEventArgs>(WebSocket_OnClose);
      _wsOnErrorEH    = new EventHandler<ErrorEventArgs>(WebSocket_OnError);
      _wsOnMessageEH  = new EventHandler<MessageEventArgs>(WebSocket_OnMessage);
    }
コード例 #5
0
        public AlertViewModel(OD.DataSource dataSource)
            : base(dataSource)
        {
            // init the data members with default values
              Properties["GepHostName"]                   = @"localhost";
              Properties["GepHttpPort"]                   = @"6180";
              Properties["GepHttpsPort"]                  = @"6143";
              Properties["GEP_INCIDENTS_ENDPOINT"]        = @"geoevent/admin/incidents";
              Properties["ALERT_ASSIGN_TO_FIELD_ALIAS"]   = @"Assigned To";
              Properties["ALERT_ASSIGN_TO_URI_PROP"]      = @"AssignedTo";
              Properties["ALERT_NOTE_FIELD_ALIAS"]        = @"Note";
              Properties["ALERT_NOTE_URI_PROP"]           = @"Note";
              Properties["ALERT_DISMISS_STATUS_URI_PROP"] = @"Dismissed";
              Properties["ALERT_DISMISSED_VALUE"]         = @"true";

              // init the commands
              DismissCommand   = new DelegatingCommand(OnDismiss);
              AssignToCommand  = new DelegatingCommand(OnAssignTo);
              NoteCommand      = new DelegatingCommand(OnNote);
        }
コード例 #6
0
 /// <summary>
 /// Called when a DataSource is removed from the configuration. 
 /// </summary>
 /// <param name="dataSource">The DataSource being removed.</param>
 public void OnRemove(OD.DataSource dataSource)
 {
     // Respond to data source being removed. The application framework will automatically show the widget as disabled
       // if it's currently configured data source is removed.
       if (dataSource.Id == DataSourceId)
     DataSourceId = null;
 }
コード例 #7
0
 /// <summary>
 /// Called when a DataSource is updated. Test the DataSource.Id to respond to the DataSource of interest.
 /// </summary>
 /// <param name="dataSource">The DataSource being updated.</param>
 public void OnRefresh(OD.DataSource dataSource)
 {
     if (dataSource.Id == DataSourceId)
       {
     // if required, respond to the update from the selected data source. consider using an async method.
     SetDataSource(dataSource);
     PopulateGrid();
       }
 }
コード例 #8
0
    internal MapWidget GetMapWidget(OD.DataSource dataSource)
    {
      if (OperationsDashboard.Instance == null)
        return null;

      IWidget widget = OperationsDashboard.Instance.FindWidget(dataSource);
      if (widget is MapWidget)
      {
        MapWidget mapWidget = widget as MapWidget;
        mapWidget.IsDrawingProgressVisible = false;
        return mapWidget;
      }

      return null;
    }
コード例 #9
0
    protected FeatureLayer FindFeatureLayer(OD.DataSource dataSource)
    {
      if (dataSource == null)
        return null;
      MapWidget mapWidget = GetMapWidget(dataSource);
      if (mapWidget == null)
        return null;

      return mapWidget.FindFeatureLayer(dataSource);
    }
コード例 #10
0
    public static async Task<GraphicsLayer> CreateCustomLayer(FeatureLayer featureLayer, OD.DataSource dataSource)
    {
      if (featureLayer == null || dataSource == null)
        return null;

      GraphicsLayer customLayer = new GraphicsLayer();
      customLayer.DisplayName = "Edit - " + featureLayer.DisplayName;
      customLayer.Renderer = featureLayer.Renderer;

      // Execute an async query
      OD.Query query = new OD.Query();
      query.ReturnGeometry = true;
      OD.QueryResult queryResult = await dataSource.ExecuteQueryAsync(query);
      if (queryResult.Canceled || queryResult.Features == null)
        return null;

      CopyGraphics(queryResult.Features, customLayer.Graphics);
      return customLayer;
    }
コード例 #11
0
    async public void Update(OD.DataSource dataSource)
    {
      if (dataSource == null)
        return;
      if (SkipUpdates)
        return;
      if (InEditMode)
        return;

      // Execute an async query
      OD.Query query = new OD.Query()
      {
        SortField = SortByFieldName1,
        SortOrder = ESRI.ArcGIS.Client.Tasks.SortOrder.Ascending,
        ReturnGeometry = true
      };
      OD.QueryResult queryResult = await dataSource.ExecuteQueryAsync(query);
      if (queryResult.Canceled || queryResult.Features == null)
      {
        Items.Clear();
        return;
      }

      //hk - RESEARCH THIS APPROACH
      /*
      List<ListItem> items = new List<ListItem>();
      int i = 0;
      foreach (var result in queryResult.Features)
      {
        items.Add(new ListItem(this, result, dataSource));
        if (++i == ListWidget.MaxCount)
          break;
      }
      */

      try
      {
        SetDataSource(dataSource);
        Update(queryResult.Features);
      }
      catch (Exception ex)
      {
        Log.TraceException("Updating " + dataSource.Name, ex);
      }

    }
コード例 #12
0
    public void SetDataSource(OD.DataSource dataSource)
    {
      if (_dataSource != dataSource)
      {
        // this will cause the schema to get recreated
        _schema = null;

        // clear the grouping
        _groupByColumnViewModels = null;

        _dataSource = dataSource;
        _map = GetMap();
        _featureLayer = FindFeatureLayer(_dataSource);
      }
    }
コード例 #13
0
    public BaseDataGridViewModel(OD.DataSource dataSource)
    {
      ViewModel = this;
      Properties = new Dictionary<string, string>();

      InEditMode             = false;
      ConvertToLocalTimeZone = true;

      // init commands
      PanToCommand             = new DelegatingCommand(OnPanTo);
      ZoomToCommand            = new DelegatingCommand(OnZoomTo);
      HighlightCommand         = new DelegatingCommand(OnHighlight);
      FollowCommand            = new DelegatingCommand(OnFollow);
      StopFollowCommand        = new DelegatingCommand(OnStopFollow);
      DeleteItemCommand        = new DelegatingCommand(OnDeleteItem);
      DeleteAllCommand         = new DelegatingCommand(OnDeleteAll);
      GroupByDelegatingCommand = new DelegatingCommand(OnGroupByAction);

      Update(dataSource);
    }
コード例 #14
0
 public void SetRouteDataSource(OD.DataSource routeDataSource)
 {
   _routesDataSource = routeDataSource;
 }