当前位置: 首页>>代码示例>>Java>>正文


Java CallbackListener类代码示例

本文整理汇总了Java中com.esri.core.map.CallbackListener的典型用法代码示例。如果您正苦于以下问题:Java CallbackListener类的具体用法?Java CallbackListener怎么用?Java CallbackListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CallbackListener类属于com.esri.core.map包,在下文中一共展示了CallbackListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queryFeatures

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
private void queryFeatures(){
	TriggerLayer triggerLayer = (TriggerLayer) layerComboBox.getSelectedItem();
	ArcGISFeatureLayer featureLayer = triggerLayer.getFeatureLayer();
	String where = whereTextField.getText();
	if(Util.isEmpty(where)){
		where = "1=1";
	}
	
	Query query = new Query();
	query.setOutFields(new String[] {"*"});
	query.setOutSpatialReference(SpatialReference.create(SpatialReference.WKID_WGS84));
	query.setWhere(where);
	featureLayer.queryFeatures(query, new CallbackListener<FeatureSet>() {
		
		@Override
		public void onCallback(FeatureSet featureSet) {
			createTrigger(featureSet);
		}
		
		@Override
		public void onError(Throwable e) {
			System.out.println("Error: "+e.getMessage());
		}
	});
}
 
开发者ID:EsriDE,项目名称:PTM-OSMGeotrigger,代码行数:26,代码来源:CreateMultipleTriggersTool.java

示例2: executeDriveTimes

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
private void executeDriveTimes(Graphic startPointGraphic) {

    // create a Geoprocessor that points to the remote geoprocessing service.
    Geoprocessor geoprocessor = new Geoprocessor(URL_GEOPROCESSING_SERVICE);
    // set the output and process spatial reference to the map's spatial reference
    geoprocessor.setOutSR(jMap.getSpatialReference());
    geoprocessor.setProcessSR(jMap.getSpatialReference());

    // initialize the required input parameters: refer to help link in the
    // geoprocessing service URL for a list of required parameters
    List<GPParameter> gpInputParams = new ArrayList<GPParameter>();

    GPFeatureRecordSetLayer gpInputStartpoint = new GPFeatureRecordSetLayer("Input_Location");
    gpInputStartpoint.addGraphic(startPointGraphic);

    GPString gpInputDriveTimes = new GPString("Drive_Times");
    gpInputDriveTimes.setValue("1 2 3");

    gpInputParams.add(gpInputStartpoint);
    gpInputParams.add(gpInputDriveTimes);

    geoprocessor.executeAsync(gpInputParams, new CallbackListener<GPParameter[]>() {

      @Override
      public void onError(Throwable th) {
        th.printStackTrace();
      }

      @Override
      public void onCallback(GPParameter[] result) {
        processResult(result);
      }
    });

  }
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:36,代码来源:DriveTimeExecutor.java

示例3: solveRoute

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
protected void solveRoute() {
  // ROUTING
  RoutingTask task = new RoutingTask(
      "http://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World", 
      credentials);

  RoutingTaskParameters parameters = new RoutingTaskParameters();
  stops.setSpatialReference(map.getSpatialReference());
  parameters.setStops(stops);
  parameters.setOutSpatialReference(map.getSpatialReference());
  task.solveAsync(parameters, new CallbackListener<RoutingResult>() {

    @Override
    public void onError(Throwable e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(map.getParent(),
          "An error has occured. "+e.getLocalizedMessage(), "", JOptionPane.WARNING_MESSAGE);
    }

    @Override
    public void onCallback(RoutingResult result) {
      if (result != null ) {
        Route topRoute = result.getRoutes().get(0);
        Graphic routeGraphic = new Graphic(topRoute.getRoute().getGeometry(),
            new SimpleLineSymbol(Color.BLUE, 2.0f));
        stopGraphics.addGraphic(routeGraphic);
      }
    }
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:31,代码来源:MyMapApp.java

示例4: onMouseClicked

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
@Override
public void onMouseClicked(MouseEvent event) {
  graphicsLayer.removeAll();

  // add buffer as a graphic
  Point mapPoint = map.toMapPoint(event.getX(), event.getY());
  final Geometry buffer = GeometryEngine.buffer(
      mapPoint, map.getSpatialReference(), 200000, map.getSpatialReference().getUnit());
  graphicsLayer.addGraphic(new Graphic(buffer, new SimpleFillSymbol(new Color(255, 0, 0, 255))));

  // get states at the buffered area
  QueryTask queryTask = new QueryTask(featureLayer.getUrl());
  QueryParameters queryParams = new QueryParameters();
  queryParams.setInSpatialReference(map.getSpatialReference());
  queryParams.setOutSpatialReference(map.getSpatialReference());
  queryParams.setGeometry(buffer);
  queryParams.setReturnGeometry(true);
  queryParams.setOutFields(new String[] {"STATE_NAME"});

  queryTask.execute(queryParams, new CallbackListener<FeatureResult>() {

    @Override
    public void onError(Throwable arg0) {
      // deal with any exception
    }

    @Override
    public void onCallback(FeatureResult result) {
      for (Object objFeature : result) {
        Feature feature = (Feature) objFeature;
        graphicsLayer.addGraphic(new Graphic(feature.getGeometry(), stateSymbol));
        graphicsLayer.addGraphic(new Graphic(buffer, new SimpleFillSymbol(new Color(255, 0, 0, 255))));


      }
    }
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:39,代码来源:GeometryOnlineApp.java

示例5: onMouseClicked

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
@Override
public void onMouseClicked(MouseEvent event) {
  graphicsLayer.removeAll();

  // add buffer as a graphic
  Point mapPoint = map.toMapPoint(event.getX(), event.getY());
  Geometry buffer = GeometryEngine.buffer(
      mapPoint, map.getSpatialReference(), 200000, map.getSpatialReference().getUnit());
  graphicsLayer.addGraphic(new Graphic(buffer, new SimpleFillSymbol(new Color(100, 0, 0, 80))));

  // get states at the buffered area
  QueryTask queryTask = new QueryTask(featureLayer.getUrl());
  QueryParameters queryParams = new QueryParameters();
  queryParams.setInSpatialReference(map.getSpatialReference());
  queryParams.setOutSpatialReference(map.getSpatialReference());
  queryParams.setGeometry(buffer);
  queryParams.setReturnGeometry(true);
  queryParams.setOutFields(new String[] {"STATE_NAME"});

  queryTask.executeAsync(queryParams, new CallbackListener<FeatureResult>() {

    @Override
    public void onError(Throwable arg0) {
      // deal with any exception
    }

    @Override
    public void onCallback(FeatureResult result) {
      for (Object objFeature : result) {
        Feature feature = (Feature) objFeature;
        graphicsLayer.addGraphic(new Graphic(feature.getGeometry(), stateSymbol));
      }
    }
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:36,代码来源:GeometryOnlineApp.java

示例6: showCurrentResult

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
/**
 * Shows the panel with the current result.
 */
public void showCurrentResult() {
    if (-1 != identifyFeatureGraphicUid) {
        graphicsLayer.removeGraphic(identifyFeatureGraphicUid);
    }
    jPanel_results.removeAll();
    Geometry geom = null;
    if (null == results || 0 >= results.length) {
        jLabel_counter.setText("0 of 0");
        jLabel_resultName.setText("");
        jLabel_distance.setText("Distance:");
        jLabel_bearing.setText("Bearing:");
    } else {
        if (results.length <= currentIndex) {
            currentIndex = 0;
        } else if (0 > currentIndex) {
            currentIndex = results.length - 1;
        }
        jLabel_counter.setText((currentIndex + 1) + " of " + results.length);
        final IdentifiedItem result = results[currentIndex];
        geom = result.getGeometry();
        
        //Get attachments, if they are available
        Layer resultLayer = (null == resultToLayer ? null : resultToLayer.get(result));
        final ArcGISFeatureLayer featureLayer = mapController.getFeatureLayer(resultLayer, result.getLayerId());
        if (null != featureLayer && featureLayer.hasAttachments()) {
            featureLayer.queryAttachmentInfos(Integer.parseInt((String) result.getAttributes().get(featureLayer.getObjectIdField())), new CallbackListener<AttachmentInfo[]>() {

                public void onCallback(AttachmentInfo[] attachmentInfos) {
                    finishShowingResult(result, attachmentInfos, featureLayer);
                }

                public void onError(Throwable e) {
                    finishShowingResult(result);
                }
                
            });
        } else {
            finishShowingResult(result);
        }
    }
    
    //Show distance and bearing from GPS location if available
    synchronized (gpsLocationLatLonLock) {
        boolean showedDistanceAndBearing = false;
        if (null != gpsLocationLatLon) {
            //Show them
            Point destinationMap = (geom instanceof Point) ? ((Point) geom) : identifyPoint;
            Point gpsLocationMap = (Point) GeometryEngine.project(gpsLocationLatLon, Utilities.WGS84, mapController.getSpatialReference());
            double distance = Math.sqrt(Math.pow(destinationMap.getX() - gpsLocationMap.getX(), 2.0) + Math.pow(destinationMap.getY() - gpsLocationMap.getY(), 2.0));
            Point destinationLatLon = (Point) GeometryEngine.project(destinationMap, mapController.getSpatialReference(), Utilities.WGS84);
            double bearing = Utilities.calculateBearingDegrees(gpsLocationLatLon, destinationLatLon);

            jLabel_distance.setText("Distance: " + Math.round(distance) + " " + mapController.getSpatialReference().getUnit().getAbbreviation());
            jLabel_bearing.setText("Bearing: " + Math.round(bearing) + "\u00B0");
            showedDistanceAndBearing = true;
        }
        if (!showedDistanceAndBearing) {
            jLabel_distance.setText("");
            jLabel_bearing.setText("");
        }
    }
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:66,代码来源:IdentifyResultsJPanel.java

示例7: getImageAsych

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
@Override
public void getImageAsych(int w, int h, Envelope extent, CallbackListener<byte[]> imagecallback) {
    super.getImageAsych(w, h, extent, imagecallback);
}
 
开发者ID:skylight1,项目名称:VR-Map-Explorer,代码行数:5,代码来源:MainActivity.java

示例8: loadMessages

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
public void loadMessages()
{
  messagesLayer = agsObjects.getMessagesLayer();
  if (messagesLayer == null)
  {
    MessagesActivity.this.runOnUiThread(new Runnable()
    {
      public void run()
      {
        SetMessageAdapter(notifications);
      }
    });
    return;
  }

  Query query = new Query();
  String routeFieldName = LayerUtility.getFieldNamebyAlias(messagesLayer, getResources().getString(R.string.ALIAS_MESSAGESLAYER_MESSAGE_TO));
  String whereClause = routeFieldName + "='" + agsObjects.getRouteId() + "'";
  query.setWhere(whereClause); 
  query.setOutFields(new String[] { "*" });
  messagesLayer.queryFeatures(query, new CallbackListener<FeatureSet>()
  {

    public void onError(Throwable e)
    {
      Log.d("MessagesActivity", "Select Features Error" + e.getLocalizedMessage());
    }

    public void onCallback(FeatureSet result)
    {
      notifications.clear();
      Graphic[] grs = result.getGraphics();
      Map<String, String> fieldAliases = new HashMap<String, String>();
      for (Field field : result.getFields())
      {
        fieldAliases.put(field.getName(), field.getAlias());
      }
      
      for (int i = 0; i < grs.length; i++)
      {
        Graphic graphic = grs[i];

        Notification notification = new Notification(graphic, context, result.getObjectIdFieldName(), fieldAliases);
        notifications.add(notification);
      }
      Collections.sort(notifications, new messageComparator());

      MessagesActivity.this.runOnUiThread(new Runnable()
      {

        public void run()
        {

          SetMessageAdapter(notifications);

        }
      });

    }
  });
}
 
开发者ID:Esri,项目名称:route-monitor-for-geoevent,代码行数:62,代码来源:MessagesActivity.java

示例9: queryRouteLayer

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
private void queryRouteLayer(ArcGISFeatureLayer layer)
{
  System.out.println("   ---   " + "Called queryRouteLayer." + "   ---   ");
  //String queryString = getResources().getString(R.string.KEY_ROUTE_NAME) + "='" + agsObjects.getRouteId() + "'";
  String routeFieldName = getFieldNamebyAlias(layer, getResources().getString(R.string.ALIAS_ROUTESLAYER_ROUTE));
  final String vehicleFieldName = getFieldNamebyAlias(layer, getResources().getString(R.string.ALIAS_ROUTESLAYER_Vehicle));
  
  String queryString = routeFieldName + "='" + agsObjects.getRouteId() + "'";
  System.out.println("   ---   " + "query string is " + queryString + "   ---   ");
  Query query = new Query();
  query.setWhere(queryString); 
  query.setOutFields(new String[] { "*" });
  layer.queryFeatures(query, new CallbackListener<FeatureSet>()
  {
      public void onError(Throwable arg0)
      {
        System.out.println("   ---   " + "queryRouteLayer error." + "   ---   ");
        progressDialog.dismiss();
      }

      public void onCallback(FeatureSet queryResults)
      {
        if (queryResults.getGraphics().length > 0)
        {
          Graphic graphic = queryResults.getGraphics()[0];
          if(graphic.getGeometry() != null)
            map.setExtent(graphic.getGeometry(), 60);
          String vehicleId = (String) graphic.getAttributeValue(vehicleFieldName);
          System.out.println("   ---   " + "Got Veh ID " + vehicleId + "   ---   ");
          agsObjects.setVehicleId(vehicleId);
          if (agsObjects.getVehiclesLayer() != null)
          {
            drawVehicleLayer(agsObjects.getVehiclesLayer());
          }
        }
        else
        {
          System.out.println("   ---   " + "queryRouteLayer got nothing." + "   ---   ");
        }
        progressDialog.dismiss();
      }
    });
}
 
开发者ID:Esri,项目名称:route-monitor-for-geoevent,代码行数:44,代码来源:NavigationActivity.java

示例10: queryRouteAssignmentLayer

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
private void queryRouteAssignmentLayer(ArcGISFeatureLayer layer)
{
  System.out.println("   ---   " + "Called queryRouteAssignmentLayer." + "   ---   ");
  final String accountName = agsObjects.getUsername();
  String accountNameFieldName = getFieldNamebyAlias(layer, getResources().getString(R.string.KEY_ACCOUNT_NAME_RA));
  final String routeNameFieldName = getFieldNamebyAlias(layer, getResources().getString(R.string.KEY_ROUTE_NAME_RA));
  String queryString = accountNameFieldName + "='" + accountName + "'";
  System.out.println("   ---   " + "query string is " + queryString + "   ---   ");
  Query query = new Query();
  query.setWhere(queryString); 
  query.setOutFields(new String[] { "*" });
  layer.queryFeatures(query, new CallbackListener<FeatureSet>()
  {
      public void onError(Throwable arg0)
      {
        System.out.println("   ---   " + "queryRouteAssignmentLayer error." + "   ---   ");
        progressDialog.dismiss();
      }

      public void onCallback(FeatureSet queryResults)
      {
        if (queryResults.getGraphics().length > 0)
        {
          Graphic graphic = queryResults.getGraphics()[0];
          String routeId = (String) graphic.getAttributeValue(routeNameFieldName);
          System.out.println("   ---   " + "Got Route ID " + routeId + "   ---   ");
          agsObjects.setRouteId(routeId);
          if (agsObjects.getRoutesLayer() != null)
            drawRouteLayer(agsObjects.getRoutesLayer());
          if (agsObjects.getStopsLayer() != null)
            drawStopLayer(agsObjects.getStopsLayer());
          if(agsObjects.getMessagesLayer() != null)
            drawMessageLayer(agsObjects.getMessagesLayer());
        }
        else
        {
          System.out.println("   ---   " + "queryRouteAssignmentLayer got nothing." + "   ---   ");
          progressDialog.dismiss();
          showAlertMessage("Warning", "No route is assigned to " + accountName);
        }
      }
    });
}
 
开发者ID:Esri,项目名称:route-monitor-for-geoevent,代码行数:44,代码来源:NavigationActivity.java

示例11: collectFeature

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
/**
 * Collects a feature of the specified type at the current device location.
 *
 * @param featureTypeName the type of feature to collect
 */
private void collectFeature(final String featureTypeName) {
  try {
    // Request a single high precision location update
    LocationRequest request = LocationRequest.create()
            .setNumUpdates(1)
            .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, request, new LocationListener() {
      @Override
      public void onLocationChanged(Location location) {
        // When we've got a location, get the FeatureType that matches the specified name
        FeatureType type = null;
        for (FeatureType ft : mArcGISFeatureLayer.getTypes()) {
          if (ft.getName().equals(featureTypeName)) {
            type = ft;
            break;
          }
        }
        // Only proceed if we found a matching type (which we always should)
        if (type != null) {
          // Create a new feature of the specified type at the current location
          Graphic g = mArcGISFeatureLayer.createFeatureWithType(type, new Point(location.getLongitude(), location.getLatitude()));
          // Apply the edit to the service
          mArcGISFeatureLayer.applyEdits(new Graphic[]{g}, null, null, new CallbackListener<FeatureEditResult[][]>() {
            @Override
            public void onCallback(FeatureEditResult[][] featureEditResults) {
              // Check that we have a success and report success
              if (featureEditResults[0].length > 0) {
                FeatureEditResult fer = featureEditResults[0][0];
                if (fer.isSuccess()) {
                  Log.i("Test", "Successfully added feature: " + fer.getObjectId());
                  Toast.makeText(CollectionActivity.this, "Successful collection!", Toast.LENGTH_SHORT).show();
                } else {
                  Log.e("Test", "Failed to add feature: " + fer.getError().getDescription());
                }
              }
            }

            @Override
            public void onError(Throwable throwable) {
              Log.e("Test", "Failed to add new graphic");
            }
          });
        } else {
          // If we don't have a matching feature type (which should never happen), log an error
          Log.e("Test", "Could not determine type");
        }
      }
    });
  } catch (SecurityException se) {
    // If we caught an exception trying to get the location, likelihood is that the location
    // permission has not been granted by the user
    Log.e("Test", "Could not access location. Check permissions.");
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demos-android,代码行数:60,代码来源:CollectionActivity.java

示例12: onFind

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
protected void onFind() {
  Locator locator = new Locator(
      "http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
  LocatorFindParameters params = new LocatorFindParameters(textField.getText());
  params.setOutSR(map.getSpatialReference());

  // additional parameters optionally, could grab the latest point from a GPS feed for example
  params.setLocation(new Point(-356903.5435, 7546014.500), map.getSpatialReference());
  params.setDistance(10000);

  // run the locator task asynchronously
  locator.findAsync(params, new CallbackListener<List<LocatorGeocodeResult>>() {

    @Override
    public void onError(Throwable e) {
      JOptionPane.showMessageDialog(map.getParent(), e.getMessage());
    }

    @Override
    public void onCallback(List<LocatorGeocodeResult> results) {
      // display top result
      if (results != null) {
        // get the top result to display on map
        LocatorGeocodeResult highestScoreResult = results.get(0);

        // create and populate attribute map
        Map<String, Object> attributes = new HashMap<String, Object>();
        for (Entry<String, String> entry : highestScoreResult.getAttributes().entrySet())
        {
          attributes.put(entry.getKey(), entry.getValue());
        }

        // create a graphic at this location
        Graphic addressGraphic = new Graphic(
            highestScoreResult.getLocation(), 
            geocodeSymbol, 
            attributes, 
            null);
        addressGraphics.addGraphic(addressGraphic);

        // centre the map at this location
        Envelope extent = map.getExtent();
        extent.centerAt(highestScoreResult.getLocation());
        map.zoomTo(extent);
      }
    }
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:49,代码来源:MyMapApp.java

示例13: executeDriveTimes

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
private void executeDriveTimes(Graphic startPointGraphic) {

      // create a Geoprocessor that points to the remote geoprocessing service.
      Geoprocessor geoprocessor = new Geoprocessor(URL_GEOPROCESSING_SERVICE);
      // set the output and process spatial reference to the map's spatial reference
      SpatialReference outSR = SpatialReference.create(4326);
      Geometry projectedStartPoint = GeometryEngine.project(
        startPointGraphic.getGeometry(), jMap.getSpatialReference(), outSR);
      Graphic projectedStartPointGraphic = new Graphic(projectedStartPoint, startPointGraphic.getSymbol());
      geoprocessor.setOutSR(outSR);
      geoprocessor.setProcessSR(outSR);

      // initialize the required input parameters: refer to help link in the
      // geoprocessing service URL for a list of required parameters
      List<GPParameter> gpInputParams = new ArrayList<GPParameter>();

      GPFeatureRecordSetLayer gpInputStartpoint = new GPFeatureRecordSetLayer("Input_Location");
      gpInputStartpoint.addGraphic(projectedStartPointGraphic);

      //GPString gpInputDriveTimes = new GPString("Drive_Time");
      // Tip: use GP service info to get the parameter names
      GPString gpInputDriveTimes = new GPString("Drive_Times");
      
      gpInputDriveTimes.setValue("1 2 3");

      gpInputParams.add(gpInputStartpoint);
      gpInputParams.add(gpInputDriveTimes);

      // execute the geoprocessing request
      /*try {
        GPParameter[] result = geoprocessor.execute(gpInputParams);
        updateProgresBarUI(null,  tasksInProgress.decrementAndGet() > 0);
        processResult(result);
      } catch (Exception ex) {
        JOptionPane.showMessageDialog(map, ex.getMessage(), "", JOptionPane.ERROR_MESSAGE);
      }*/
      
      // Tip: Do not block UI thread. 
      geoprocessor.executeAsync( 
        gpInputParams, 
        new CallbackListener<GPParameter[]>() {
            @Override 
            public void onError(Throwable th) { 
              th.printStackTrace(); 
            }
            @Override 
            public void onCallback(GPParameter[] result) { 
              updateProgresBarUI(null, tasksInProgress.decrementAndGet() > 0); 
              processResult(result); 
              } 
            } 
        );       
    }
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:54,代码来源:DemoTheatreAppImproved.java

示例14: onMouseMoved

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
/**
 * Handle mouse-clicks.
 * On left-click - draws either a polyline or a point.
 * On right-click - computes and draws the buffer of the polyline or point.
 */
@Override
public void onMouseMoved(MouseEvent event) {
  super.onMouseMoved(event);

  gLayer.removeAll();

  Point currPoint = jMap.toMapPoint(event.getX(), event.getY());
  // point
  bufferedArea = GeometryEngine.buffer(
      currPoint,
      jMap.getSpatialReference(),
      BUFFER_DISTANCE,
      jMap.getSpatialReference().getUnit());
  Graphic currPointGraphic = new Graphic(currPoint, GeometryOfflineApp.SYM_POINT);
  gLayer.addGraphic(currPointGraphic);

  // add the buffered area to the graphics layer
  Graphic bufferedGraphic = new Graphic(bufferedArea, GeometryOfflineApp.SYM_BUFFER);
  gLayer.addGraphic(bufferedGraphic);

  if (queryInProgress.get() == false) {
    // query
    QueryParameters query = new QueryParameters();
    query.setReturnGeometry(true);
    query.setGeometry(bufferedArea);
    query.setOutFields(new String[] {"STATE_NAME"});

    // execute the query.
    table.queryFeatures(query, new CallbackListener<FeatureResult>() {

      
      @Override
      public void onError(Throwable e) {
        e.printStackTrace();
      }

      @Override
      public void onCallback(FeatureResult result) {
        gLayerResults.removeAll();
        for (Object objFeature : result) {
          Feature feature = (Feature) objFeature;
          gLayerResults.addGraphic(new Graphic(feature.getGeometry(), SYM_BUFFER));
        }
        queryInProgress.set(false);
      }
    });
    queryInProgress.set(true);
  }

  prevPoint = null;
  polyLine.setEmpty();

  return;
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:60,代码来源:GeometryOfflineApp.java

示例15: onMouseMoved

import com.esri.core.map.CallbackListener; //导入依赖的package包/类
/**
 * Handle mouse-clicks.
 * On left-click - draws either a polyline or a point.
 * On right-click - computes and draws the buffer of the polyline or point.
 */
@Override
public void onMouseMoved(MouseEvent event) {
  super.onMouseMoved(event);

  gLayer.removeAll();

  Point currPoint = jMap.toMapPoint(event.getX(), event.getY());
  // point
  bufferedArea = GeometryEngine.buffer(
      currPoint,
      jMap.getSpatialReference(),
      BUFFER_DISTANCE,
      jMap.getSpatialReference().getUnit());
  Graphic currPointGraphic = new Graphic(currPoint, GeometryApp.SYM_POINT);
  gLayer.addGraphic(currPointGraphic);

  // add the buffered area to the graphics layer
  Graphic bufferedGraphic = new Graphic(bufferedArea, GeometryApp.SYM_BUFFER);
  gLayer.addGraphic(bufferedGraphic);

  if (queryInProgress.get() == false) {
    // query
    QueryParameters query = new QueryParameters();
    query.setReturnGeometry(true);
    query.setGeometry(bufferedArea);
    query.setOutFields(new String[] {"STATE_NAME"});

    // execute the query.
    table.queryFeatures(query, new CallbackListener<FeatureResult>() {

      
      @Override
      public void onError(Throwable e) {
        e.printStackTrace();
      }

      @Override
      public void onCallback(FeatureResult result) {
        gLayerResults.removeAll();
        for (Object objFeature : result) {
          Feature feature = (Feature) objFeature;
          gLayerResults.addGraphic(new Graphic(feature.getGeometry(), SYM_BUFFER));
        }
        queryInProgress.set(false);
      }
    });
    queryInProgress.set(true);
  }

  prevPoint = null;
  polyLine.setEmpty();

  return;
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:60,代码来源:GeometryApp.java


注:本文中的com.esri.core.map.CallbackListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。