• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Graphic类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: showCalloutForGraphic

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Shows the callout for a given graphic
 * @param graphic the graphic selected by the user
 * @param tapLocation the location selected at a Point
 */
private void showCalloutForGraphic(Graphic graphic, Point tapLocation) {
    TextView calloutTextView = (TextView) getLayoutInflater().inflate(callout, null);
    calloutTextView.setText(graphic.getAttributes().get("Match_addr").toString());
    mCallout = mMapView.getCallout();
    mCallout.setLocation(tapLocation);
    mCallout.setContent(calloutTextView);
    mCallout.show();
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:14,代码来源:MobileMapViewActivity.java


示例2: reverseGeocode

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 *  Calls reverseGeocode on a Locator Task and, if there is a result, passes the result to a
 *  Callout method
 * @param point user generated map point
 * @param graphic used for marking the point on which the user touched
 */
private void reverseGeocode(final Point point, final Graphic graphic) {
    if (mLocatorTask != null) {
        final ListenableFuture<List<GeocodeResult>> results =
                mLocatorTask.reverseGeocodeAsync(point, mReverseGeocodeParameters);
        results.addDoneListener(new Runnable() {
            public void run() {
                try {
                    List<GeocodeResult> geocodeResult = results.get();
                    if (geocodeResult.size() > 0) {
                        graphic.getAttributes().put(
                                "Match_addr", geocodeResult.get(0).getLabel());
                        showCalloutForGraphic(graphic, point);
                    } else {
                        //no result was found
                        mMapView.getCallout().dismiss();
                    }
                } catch (InterruptedException | ExecutionException e) {
                    e.printStackTrace();
                }
            }
        });
    }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:30,代码来源:MobileMapViewActivity.java


示例3: stopsForGraphics

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Converts a given list of graphics into a list of stops
 * @param graphics
 * @return a list of stops
 */
private List stopsForGraphics(List<Graphic> graphics) {
    List<Stop> stops = new ArrayList<>();
    for (Graphic graphic : graphics) {
        Stop stop = new Stop((Point)graphic.getGeometry());
        stops.add(stop);
    }
    return stops;
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:14,代码来源:MobileMapViewActivity.java


示例4: showClickedLocation

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Create and add a marker to the map representing
 * the clicked location.
 * @param point - A com.esri.arcgisruntime.geometry.Point item
 */
@Override public void showClickedLocation(final Point point) {
  final Bitmap icon = BitmapFactory.decodeResource(getActivity().getResources(), R.mipmap.blue_pin);
  final BitmapDrawable drawable = new BitmapDrawable(getResources(), icon);
  final PictureMarkerSymbol markerSymbol = new PictureMarkerSymbol(drawable);
  markerSymbol.setHeight(40);
  markerSymbol.setWidth(40);
  markerSymbol.setOffsetY(markerSymbol.getHeight()/2);
  markerSymbol.loadAsync();
  markerSymbol.addDoneLoadingListener(new Runnable() {
    @Override public void run() {
      final Graphic marker = new Graphic(point, markerSymbol);
      mGraphicOverlay.getGraphics().clear();
      mGraphicOverlay.getGraphics().add(marker);
    }
  });

}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:23,代码来源:MapFragment.java


示例5: createGraphics

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Create red and green triangle graphics and displays them to the view.
 */
private void createGraphics() {

  // applies graphics to the view who's altitude is increased by surface's elevation
  GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
  graphicsOverlay.getSceneProperties().setSurfacePlacement(SurfacePlacement.ABSOLUTE);
  sceneView.getGraphicsOverlays().add(graphicsOverlay);

  // creating graphics for view
  redPoint = new Point(-77.69531409620706, 40.25390707699415, 900, sr);
  redSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.TRIANGLE, 0xFFFF0000, 20);
  redGraphic = new Graphic(redPoint, redSymbol);
  graphicsOverlay.getGraphics().add(redGraphic);

  greenPoint = new Point(-120.05859621653715, 38.847657048103514, 1000, sr);
  greenSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.TRIANGLE, 0xFF00FF00, 20);
  greenSymbol.setAngle(30);
  greenGraphic = new Graphic(greenPoint, greenSymbol);
  graphicsOverlay.getGraphics().add(greenGraphic);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:23,代码来源:CalculateDistance3dController.java


示例6: createFacilitiesAndGraphics

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Creates facilities around the San Diego region.
 * <p>
 * Facilities are created using point geometry which is then used to make graphics for the graphics overlay.
 */
private void createFacilitiesAndGraphics() {
  // List of facilities to be placed around San Diego area
  facilities = Arrays.asList(
      new Facility(new Point(-1.3042129900625112E7, 3860127.9479775648, spatialReference)),
      new Facility(new Point(-1.3042193400557665E7, 3862448.873041752, spatialReference)),
      new Facility(new Point(-1.3046882875518233E7, 3862704.9896770366, spatialReference)),
      new Facility(new Point(-1.3040539754780494E7, 3862924.5938606677, spatialReference)),
      new Facility(new Point(-1.3042571225655518E7, 3858981.773018156, spatialReference)),
      new Facility(new Point(-1.3039784633928463E7, 3856692.5980474586, spatialReference)),
      new Facility(new Point(-1.3049023883956768E7, 3861993.789732541, spatialReference)));

  // image for displaying facility
  String facilityUrl = "http://static.arcgis.com/images/Symbols/SafetyHealth/Hospital.png";
  PictureMarkerSymbol facilitySymbol = new PictureMarkerSymbol(facilityUrl);
  facilitySymbol.setHeight(30);
  facilitySymbol.setWidth(30);

  // for each facility, create a graphic and add to graphics overlay
  facilities.stream().map(f -> new Graphic(f.getGeometry(), facilitySymbol))
      .collect(Collectors.toCollection(() -> facilityGraphicsOverlay.getGraphics()));
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:27,代码来源:ClosestFacilitySample.java


示例7: placePictureMarkerSymbol

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Adds a Graphic to the Graphics Overlay using a Point and a Picture Marker
 * Symbol.
 * 
 * @param markerSymbol PictureMarkerSymbol to be used
 * @param graphicPoint where the Graphic is going to be placed
 */
private void placePictureMarkerSymbol(PictureMarkerSymbol markerSymbol, Point graphicPoint) {

  // set size of the image
  markerSymbol.setHeight(40);
  markerSymbol.setWidth(40);

  // load symbol asynchronously
  markerSymbol.loadAsync();

  // add to the graphic overlay once done loading
  markerSymbol.addDoneLoadingListener(() -> {
    if (markerSymbol.getLoadStatus() == LoadStatus.LOADED) {
      Graphic symbolGraphic = new Graphic(graphicPoint, markerSymbol);
      graphicsOverlay.getGraphics().add(symbolGraphic);
    } else {
      Alert alert = new Alert(Alert.AlertType.ERROR, "Picture Marker Symbol Failed to Load!");
      alert.show();
    }
  });

}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:29,代码来源:PictureMarkerSymbolSample.java


示例8: createGraphic

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Creates a graphic using a symbol dictionary and the attributes that were passed.
 * 
 * @param attributes tells symbol dictionary what symbol to apply to graphic
 */
private static Graphic createGraphic(Map<String, Object> attributes) {

  // get spatial reference
  int wkid = Integer.parseInt((String) attributes.get("_wkid"));
  SpatialReference sr = SpatialReference.create(wkid);

  // get points from coordinates' string
  PointCollection points = new PointCollection(sr);
  String[] coordinates = ((String) attributes.get("_control_points")).split(";");
  Stream.of(coordinates)
      .map(cs -> cs.split(","))
      .map(c -> new Point(Double.valueOf(c[0]), Double.valueOf(c[1]), sr))
      .collect(Collectors.toCollection(() -> points));

  // return a graphic with multipoint geometry
  return new Graphic(new Multipoint(points), attributes);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:23,代码来源:DictionaryRendererGraphicsOverlaySample.java


示例9: createText

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Creates two TextSymbols and adds them to a GraphicsOverlay.
 */
private void createText() {

  // create two text symbols
  TextSymbol bassRockTextSymbol = new TextSymbol(10, "Bass Rock", BLUE, HorizontalAlignment.LEFT,
      VerticalAlignment.BOTTOM);

  TextSymbol craigleithTextSymbol = new TextSymbol(10, "Craigleith", BLUE, HorizontalAlignment.RIGHT,
      VerticalAlignment.TOP);

  // create two points
  Point bassPoint = new Point(-2.64, 56.079, SPATIAL_REFERENCE);
  Point craigleithPoint = new Point(-2.72, 56.076, SPATIAL_REFERENCE);

  // create two graphics from the points and symbols
  Graphic bassRockGraphic = new Graphic(bassPoint, bassRockTextSymbol);
  Graphic craigleithGraphic = new Graphic(craigleithPoint, craigleithTextSymbol);

  // add graphics to the graphics overlay
  graphicsOverlay.getGraphics().add(bassRockGraphic);
  graphicsOverlay.getGraphics().add(craigleithGraphic);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:25,代码来源:AddGraphicsWithSymbolsSample.java


示例10: addGraphicsOverlay

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Creates four different Graphics and renders them to the GrapicsOverlay.
 * 
 */
private void addGraphicsOverlay() {

  // polygon graphic
  PointCollection pointsPoly = new PointCollection(mapView.getSpatialReference());
  pointsPoly.add(new Point(-20E5, 20E5));
  pointsPoly.add(new Point(20E5, 20E5));
  pointsPoly.add(new Point(20E5, -20E5));
  pointsPoly.add(new Point(-20E5, -20E5));
  // hex code for yellow color
  int yellowColor = 0xFFFFFF00;
  SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, yellowColor, null);
  Polygon polygon = new Polygon(pointsPoly);
  // create graphic from polygon and symbol
  Graphic polygonGraphic = new Graphic(polygon, fillSymbol);
  // add the polygon graphic
  graphicsOverlay.getGraphics().add(polygonGraphic);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:22,代码来源:IdentifyGraphicsSample.java


示例11: createGraphicDialog

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Indicates when a graphic is clicked by showing an Alert.
 */
private void createGraphicDialog() {

  try {
    // get the list of graphics returned by identify
    IdentifyGraphicsOverlayResult result = identifyGraphics.get();
    List<Graphic> graphics = result.getGraphics();

    if (!graphics.isEmpty()) {
      // show a alert dialog box if a graphic was returned
      Alert dialog = new Alert(AlertType.INFORMATION);
      dialog.setHeaderText(null);
      dialog.setTitle("Information Dialog Sample");
      dialog.setContentText("Clicked on " + graphics.size() + " graphic");
      dialog.showAndWait();
    }
  } catch (Exception e) {
    // on any error, display the stack trace
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:24,代码来源:IdentifyGraphicsSample.java


示例12: addBuoyPoints

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
private void addBuoyPoints(GraphicsOverlay graphicOverlay) {
    //define the buoy locations
    Point buoy1Loc = new Point(-2.712642647560347, 56.062812566811544, wgs84);
    Point buoy2Loc = new Point(-2.6908416959572303, 56.06444173689877, wgs84);
    Point buoy3Loc = new Point(-2.6697273884990937, 56.064250073402874, wgs84);
    Point buoy4Loc = new Point(-2.6395150461199726, 56.06127916736989, wgs84);
    //create a marker symbol
    SimpleMarkerSymbol buoyMarker = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10);
    //create graphics
    Graphic buoyGraphic1 = new Graphic(buoy1Loc, buoyMarker);
    Graphic buoyGraphic2 = new Graphic(buoy2Loc, buoyMarker);
    Graphic buoyGraphic3 = new Graphic(buoy3Loc, buoyMarker);
    Graphic buoyGraphic4 = new Graphic(buoy4Loc, buoyMarker);
    //add the graphics to the graphics overlay
    graphicOverlay.getGraphics().add(buoyGraphic1);
    graphicOverlay.getGraphics().add(buoyGraphic2);
    graphicOverlay.getGraphics().add(buoyGraphic3);
    graphicOverlay.getGraphics().add(buoyGraphic4);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:20,代码来源:MainActivity.java


示例13: addText

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
private void addText(GraphicsOverlay graphicOverlay) {
    //create a point geometry
    Point bassLocation = new Point(-2.640631, 56.078083,wgs84);
    Point craigleithLocation = new Point (-2.720324, 56.073569,wgs84);

    //create text symbols
    TextSymbol bassRockSymbol =
            new TextSymbol(10, "Bass Rock", Color.rgb(0, 0, 230),
                    TextSymbol.HorizontalAlignment.LEFT, TextSymbol.VerticalAlignment.BOTTOM);
    TextSymbol craigleithSymbol = new TextSymbol(10, "Craigleith", Color.rgb(0, 0, 230),
                    TextSymbol.HorizontalAlignment.RIGHT, TextSymbol.VerticalAlignment.TOP);

    //define a graphic from the geometry and symbol
    Graphic bassRockGraphic = new Graphic(bassLocation, bassRockSymbol);
    Graphic craigleithGraphic = new Graphic(craigleithLocation, craigleithSymbol);
    //add the text to the graphics overlay
    graphicOverlay.getGraphics().add(bassRockGraphic);
    graphicOverlay.getGraphics().add(craigleithGraphic);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:20,代码来源:MainActivity.java


示例14: displaySearchResult

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
private void displaySearchResult(Point resultPoint, String address) {


        if (mMapView.getCallout().isShowing()) {
            mMapView.getCallout().dismiss();
        }
        //remove any previous graphics/search results
        //mMapView.getGraphicsOverlays().clear();
        graphicsOverlay.getGraphics().clear();
        // create graphic object for resulting location
        Graphic resultLocGraphic = new Graphic(resultPoint, mPinSourceSymbol);
        // add graphic to location layer
        graphicsOverlay.getGraphics().add(resultLocGraphic);

        // Zoom map to geocode result location
        mMapView.setViewpointAsync(new Viewpoint(resultPoint, 8000), 3);

        mGraphicPoint = resultPoint;
        mGraphicPointAddress = address;
    }
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:21,代码来源:MainActivity.java


示例15: createPictureMarkerSymbolFromFile

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Create a picture marker symbol from an image on disk. Called from checkSaveResourceToExternalStorage() or
 * onRequestPermissionsResult which validate required external storage and permissions
 */
private void createPictureMarkerSymbolFromFile() {

  //[DocRef: Name=Picture Marker Symbol File-android, Category=Fundamentals, Topic=Symbols and Renderers]
  //Create a picture marker symbol from a file on disk
  BitmapDrawable pinBlankOrangeDrawable = (BitmapDrawable) Drawable.createFromPath(mPinBlankOrangeFilePath);
  final PictureMarkerSymbol pinBlankOrangeSymbol = new PictureMarkerSymbol(pinBlankOrangeDrawable);
  //Optionally set the size, if not set the image will be auto sized based on its size in pixels,
  //its appearance would then differ across devices with different resolutions.
  pinBlankOrangeSymbol.setHeight(20);
  pinBlankOrangeSymbol.setWidth(20);
  //Optionally set the offset, to align the base of the symbol aligns with the point geometry
  pinBlankOrangeSymbol.setOffsetY(10); //The image used has not buffer and therefore the Y offset is height/2
  pinBlankOrangeSymbol.loadAsync();
  //[DocRef: END]
  pinBlankOrangeSymbol.addDoneLoadingListener(new Runnable() {
    @Override
    public void run() {
      //add a new graphic with the same location as the initial viewpoint
      Point pinBlankOrangePoint = new Point(-228835, 6550763, SpatialReferences.getWebMercator());
      Graphic pinBlankOrangeGraphic = new Graphic(pinBlankOrangePoint, pinBlankOrangeSymbol);
      mGraphicsOverlay.getGraphics().add(pinBlankOrangeGraphic);
    }
  });

}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:30,代码来源:MainActivity.java


示例16: showCallout

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Shows the Graphic's attributes as a Callout.
 *
 * @param graphic containing attributes
 */
private void showCallout(final Graphic graphic) {
  // create a TextView for the Callout
  TextView calloutContent = new TextView(getApplicationContext());
  calloutContent.setTextColor(Color.BLACK);
  // set the text of the Callout to graphic's attributes
  calloutContent.setText(graphic.getAttributes().get("PlaceName").toString() + "\n"
      + graphic.getAttributes().get("StAddr").toString());
  // get Callout
  mCallout = mMapView.getCallout();
  // set Callout options: animateCallout: true, recenterMap: false, animateRecenter: false
  mCallout.setShowOptions(new Callout.ShowOptions(true, false, false));
  mCallout.setContent(calloutContent);
  // set the leader position and show the callout
  // set the leader position and show the callout
  Point calloutLocation = graphic.computeCalloutLocation(graphic.getGeometry().getExtent().getCenter(), mMapView);
  mCallout.setGeoElement(graphic, calloutLocation);
  mCallout.show();
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:24,代码来源:MainActivity.java


示例17: displaySearchResult

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Turns a GeocodeResult into a Point and adds it to a GraphicOverlay which is then drawn on the map.
 *
 * @param geocodeResult a single geocode result
 */
private void displaySearchResult(GeocodeResult geocodeResult) {
  // dismiss any callout
  if (mMapView.getCallout() != null && mMapView.getCallout().isShowing()) {
    mMapView.getCallout().dismiss();
  }
  // clear map of existing graphics
  mMapView.getGraphicsOverlays().clear();
  mGraphicsOverlay.getGraphics().clear();
  // create graphic object for resulting location
  Point resultPoint = geocodeResult.getDisplayLocation();
  Graphic resultLocGraphic = new Graphic(resultPoint, geocodeResult.getAttributes(), mPinSourceSymbol);
  // add graphic to location layer
  mGraphicsOverlay.getGraphics().add(resultLocGraphic);
  // zoom map to result over 3 seconds
  mMapView.setViewpointAsync(new Viewpoint(geocodeResult.getExtent()), 3);
  // set the graphics overlay to the map
  mMapView.getGraphicsOverlays().add(mGraphicsOverlay);
  showCallout(resultLocGraphic);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:25,代码来源:MainActivity.java


示例18: addGraphicsOverlay

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
private void addGraphicsOverlay() {
    // create the polygon
    PolygonBuilder polygonGeometry = new PolygonBuilder(SpatialReferences.getWebMercator());
    polygonGeometry.addPoint(-20e5, 20e5);
    polygonGeometry.addPoint(20e5, 20.e5);
    polygonGeometry.addPoint(20e5, -20e5);
    polygonGeometry.addPoint(-20e5, -20e5);

    // create solid line symbol
    SimpleFillSymbol polygonSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.YELLOW, null);
    // create graphic from polygon geometry and symbol
    Graphic graphic = new Graphic(polygonGeometry.toGeometry(), polygonSymbol);

    // create graphics overlay
    grOverlay = new GraphicsOverlay();
    // create list of graphics
    ListenableList<Graphic> graphics = grOverlay.getGraphics();
    // add graphic to graphics overlay
    graphics.add(graphic);
    // add graphics overlay to the MapView
    mMapView.getGraphicsOverlays().add(grOverlay);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:23,代码来源:MainActivity.java


示例19: showReverseGeocodeResult

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Displays any gecoded results by add a PictureMarkerSymbol to the map's
 * graphics layer.
 *
 * @param results
 *            A list of GeocodeResult items
 */
private void showReverseGeocodeResult(List<GeocodeResult> results) {

	if (results != null && results.size() > 0) {
		// Show the first item returned
		// Address string is saved for use in routing
		mLocationLayerPointString = results.get(0).getLabel();
		mFoundLocation = results.get(0).getDisplayLocation();
		// Draw marker on map.
		// create marker symbol to represent location

		BitmapDrawable bitmapDrawable = (BitmapDrawable) ContextCompat
				.getDrawable(getActivity().getApplicationContext(), R.drawable.pin_circle_red);
		PictureMarkerSymbol destinationSymbol = new PictureMarkerSymbol(bitmapDrawable);
		mLocationLayer.getGraphics().add(new Graphic(mFoundLocation, destinationSymbol));

		// center the map to result location
		mMapView.setViewpointCenterAsync(mFoundLocation);

		// Show the result on the search result layout
		showSearchResultLayout(mLocationLayerPointString);
	}
}
 
开发者ID:Esri,项目名称:maps-app-android,代码行数:30,代码来源:MapFragment.java


示例20: displaySearchResult

import com.esri.arcgisruntime.mapping.view.Graphic; //导入依赖的package包/类
/**
 * Display content for given location.
 * @param resultPoint - Point
 * @param calloutContent - View
 * @param zoomOut - boolean, true to zoom out
 */
@Override public void displaySearchResult(final Point resultPoint, final View calloutContent, final boolean zoomOut) {

  //remove any previous graphics/search results
  mGraphicsOverlay.getGraphics().clear();

  // create graphic object for resulting location
  final Graphic resultLocGraphic = new Graphic(resultPoint, mPinSourceSymbol);
  // add graphic to location layer
  mGraphicsOverlay.getGraphics().add(resultLocGraphic);

  if (zoomOut){
    // Zoom map to geocode result location
    mMapView.setViewpointAsync(new Viewpoint(resultPoint, 8000), 3);
  }

  mCallout = mMapView.getCallout();

  //Don't show a callout if we have no view info
  if (calloutContent == null){
    mCallout.dismiss();
    return;
  }

  final Callout.Style style = new Callout.Style(getContext());
  style.setMinWidth(350);
  style.setMaxWidth(350);
  style.setLeaderPosition(Callout.Style.LeaderPosition.UPPER_MIDDLE);
  mCallout.setLocation(resultPoint);
  mCallout.setContent(calloutContent);
  mCallout.setShowOptions(new Callout.ShowOptions(true,false,false));
  mCallout.setStyle(style);

  mCallout.show();
}
 
开发者ID:Esri,项目名称:mapbook-android,代码行数:41,代码来源:MapFragment.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TypeUtil类代码示例发布时间:2022-05-23
下一篇:
Java ChannelInterceptor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap