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


Java PictureMarkerSymbol.setOffsetY方法代码示例

本文整理汇总了Java中com.esri.arcgisruntime.symbology.PictureMarkerSymbol.setOffsetY方法的典型用法代码示例。如果您正苦于以下问题:Java PictureMarkerSymbol.setOffsetY方法的具体用法?Java PictureMarkerSymbol.setOffsetY怎么用?Java PictureMarkerSymbol.setOffsetY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.esri.arcgisruntime.symbology.PictureMarkerSymbol的用法示例。


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

示例1: showClickedLocation

import com.esri.arcgisruntime.symbology.PictureMarkerSymbol; //导入方法依赖的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

示例2: createPictureMarkerSymbolFromFile

import com.esri.arcgisruntime.symbology.PictureMarkerSymbol; //导入方法依赖的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

示例3: createMarkerGraphic

import com.esri.arcgisruntime.symbology.PictureMarkerSymbol; //导入方法依赖的package包/类
private Graphic createMarkerGraphic(Point point, boolean endPoint) {

		BitmapDrawable bitmapDrawable = (BitmapDrawable) ContextCompat.getDrawable(
				getActivity().getApplicationContext(),
				endPoint ? R.drawable.pin_circle_blue : R.drawable.pin_circle_red);
		PictureMarkerSymbol destinationSymbol = new PictureMarkerSymbol(bitmapDrawable);
		// NOTE: marker's bounds not set till marker is used to create
		// destinationSymbol
		float offsetY = convertPixelsToDp(getActivity(),
				bitmapDrawable.getBounds().bottom);
		destinationSymbol.setOffsetY(offsetY);
		return new Graphic(point, destinationSymbol);
	}
 
开发者ID:Esri,项目名称:maps-app-android,代码行数:14,代码来源:MapFragment.java

示例4: setUpOfflineMapGeocoding

import com.esri.arcgisruntime.symbology.PictureMarkerSymbol; //导入方法依赖的package包/类
private void setUpOfflineMapGeocoding() {
    // create a basemap from a local tile package
    TileCache tileCache = new TileCache(extern + getResources().getString(R.string.sandiego_tpk));
    tiledLayer = new ArcGISTiledLayer(tileCache);
    Basemap basemap = new Basemap(tiledLayer);

    // create ArcGISMap with imagery basemap
    mMap = new ArcGISMap(basemap);

    mMapView.setMap(mMap);

    mMap.addDoneLoadingListener(new Runnable() {
        @Override
        public void run() {
            Point p = new Point(-117.162040, 32.718260, SpatialReference.create(4326));
            Viewpoint vp = new Viewpoint(p, 10000);
            mMapView.setViewpointAsync(vp, 3);
        }
    });


    // add a graphics overlay
    graphicsOverlay = new GraphicsOverlay();
    graphicsOverlay.setSelectionColor(Color.CYAN);
    mMapView.getGraphicsOverlays().add(graphicsOverlay);


    mGeocodeParameters = new GeocodeParameters();
    mGeocodeParameters.getResultAttributeNames().add("*");
    mGeocodeParameters.setMaxResults(1);

    //[DocRef: Name=Picture Marker Symbol Drawable-android, Category=Fundamentals, Topic=Symbols and Renderers]
    //Create a picture marker symbol from an app resource
    BitmapDrawable startDrawable = (BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.pin);
    mPinSourceSymbol = new PictureMarkerSymbol(startDrawable);
    mPinSourceSymbol.setHeight(90);
    mPinSourceSymbol.setWidth(20);
    mPinSourceSymbol.loadAsync();
    mPinSourceSymbol.setLeaderOffsetY(45);
    mPinSourceSymbol.setOffsetY(-48);

    mReverseGeocodeParameters = new ReverseGeocodeParameters();
    mReverseGeocodeParameters.getResultAttributeNames().add("*");
    mReverseGeocodeParameters.setOutputSpatialReference(mMap.getSpatialReference());
    mReverseGeocodeParameters.setMaxResults(1);

    mLocatorTask = new LocatorTask(extern + getResources().getString(R.string.sandiego_loc));

    mCalloutContent = new TextView(getApplicationContext());
    mCalloutContent.setTextColor(Color.BLACK);
    mCalloutContent.setTextIsSelectable(true);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:53,代码来源:MainActivity.java

示例5: onCreate

import com.esri.arcgisruntime.symbology.PictureMarkerSymbol; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  // inflate MapView from layout
  mMapView = (MapView) findViewById(R.id.mapView);

  // create a map with the imagery basemap
  ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

  // set the map to be displayed in the mapview
  mMapView.setMap(map);

  // create an initial viewpoint using an envelope (of two points, bottom left and top right)
  Envelope envelope = new Envelope(new Point(-228835, 6550763, SpatialReferences.getWebMercator()),
      new Point(-223560, 6552021, SpatialReferences.getWebMercator()));
  //set viewpoint on mapview
  mMapView.setViewpointGeometryAsync(envelope, 100.0);

  // create a new graphics overlay and add it to the mapview
  mGraphicsOverlay = new GraphicsOverlay();
  mMapView.getGraphicsOverlays().add(mGraphicsOverlay);

  //[DocRef: Name=Picture Marker Symbol URL, Category=Fundamentals, Topic=Symbols and Renderers]
  //Create a picture marker symbol from a URL resource
  //When using a URL, you need to call load to fetch the remote resource
  final PictureMarkerSymbol campsiteSymbol = new PictureMarkerSymbol(
      "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Recreation/FeatureServer/0/images/e82f744ebb069bb35b234b3fea46deae");
  //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.
  campsiteSymbol.setHeight(18);
  campsiteSymbol.setWidth(18);
  campsiteSymbol.loadAsync();
  //[DocRef: END]
  campsiteSymbol.addDoneLoadingListener(new Runnable() {
    @Override
    public void run() {
      //Once the symbol has loaded, add a new graphic to the graphic overlay
      Point campsitePoint = new Point(-223560, 6552021, SpatialReferences.getWebMercator());
      Graphic campsiteGraphic = new Graphic(campsitePoint, campsiteSymbol);
      mGraphicsOverlay.getGraphics().add(campsiteGraphic);
    }
  });

  //[DocRef: Name=Picture Marker Symbol Drawable-android, Category=Fundamentals, Topic=Symbols and Renderers]
  //Create a picture marker symbol from an app resource
  BitmapDrawable pinStarBlueDrawable = (BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.pin_star_blue);
  final PictureMarkerSymbol pinStarBlueSymbol = new PictureMarkerSymbol(pinStarBlueDrawable);
  //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.
  pinStarBlueSymbol.setHeight(40);
  pinStarBlueSymbol.setWidth(40);
  //Optionally set the offset, to align the base of the symbol aligns with the point geometry
  pinStarBlueSymbol.setOffsetY(
      11); //The image used for the symbol has a transparent buffer around it, so the offset is not simply height/2
  pinStarBlueSymbol.loadAsync();
  //[DocRef: END]
  pinStarBlueSymbol.addDoneLoadingListener(new Runnable() {
    @Override
    public void run() {
      //add a new graphic with the same location as the initial viewpoint
      Point pinStarBluePoint = new Point(-226773, 6550477, SpatialReferences.getWebMercator());
      Graphic pinStarBlueGraphic = new Graphic(pinStarBluePoint, pinStarBlueSymbol);
      mGraphicsOverlay.getGraphics().add(pinStarBlueGraphic);
    }
  });

  //see createPictureMarkerSymbolFromFile() method for implementation
  //first run checks for external storage and permissions,
  checkSaveResourceToExternalStorage();

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

示例6: setUpOfflineMapGeocoding

import com.esri.arcgisruntime.symbology.PictureMarkerSymbol; //导入方法依赖的package包/类
/**
 * Sets up a LocatorTask from the loaded mobile map package, and graphics to show results from running the task.
 * Shows a message to user if Locator task is not found.
 */
private void setUpOfflineMapGeocoding() {

  if (mMobileMapPackage.getLocatorTask() == null) {
    Snackbar.make(mMapView, "Current mobile map package has no LocatorTask", Snackbar.LENGTH_SHORT).show();
    return;
  }

  // Get LocatorTask from loaded MobileMapPackage and listen for loading events
  mLocatorTask = mMobileMapPackage.getLocatorTask();
  mLocatorTask.addDoneLoadingListener(new Runnable() {
    @Override
    public void run() {
      if (mLocatorTask.getLoadStatus() != LoadStatus.LOADED) {
        Snackbar.make(mMapView, String.format(getString(R.string.object_not_loaded), "LocatorTask"),
            Snackbar.LENGTH_SHORT).show();
      }
    }
  });
  mLocatorTask.loadAsync();

  // Add a graphics overlay that will be used for geocoding results
  graphicsOverlay = new GraphicsOverlay();
  graphicsOverlay.setSelectionColor(0xFF00FFFF);
  mMapView.getGraphicsOverlays().add(graphicsOverlay);

  // Define the parameters that will be used by the locator task
  mGeocodeParameters = new GeocodeParameters();
  mGeocodeParameters.getResultAttributeNames().add("*");
  mGeocodeParameters.setMaxResults(10); //1);
  mGeocodeParameters.setOutputSpatialReference(mMapView.getSpatialReference());

  //Create picture marker symbols from app resources for geocode results
  BitmapDrawable addressDrawable = (BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.pin_blank_orange);
  mFromAddressSymbol = new PictureMarkerSymbol(addressDrawable);
  mFromAddressSymbol.setHeight(64);
  mFromAddressSymbol.setWidth(64);
  mFromAddressSymbol.loadAsync();
  mFromAddressSymbol.setLeaderOffsetY(32);
  mFromAddressSymbol.setOffsetY(32);

  BitmapDrawable hydrantDrawable = (BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.pin_circle_blue_d);
  mToAddressSymbol = new PictureMarkerSymbol(hydrantDrawable);
  mToAddressSymbol.setHeight(64);
  mToAddressSymbol.setWidth(64);
  mToAddressSymbol.loadAsync();
  mToAddressSymbol.setLeaderOffsetY(32);
  mToAddressSymbol.setOffsetY(32);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demos-android,代码行数:53,代码来源:GeocodeRouteActivity.java

示例7: generateRoutePoints

import com.esri.arcgisruntime.symbology.PictureMarkerSymbol; //导入方法依赖的package包/类
/**
 * Helper method for creating start/end graphic used
 * to display the route on the map
 * @param p - point representing location on the map
 * @param pin - BitmapDrawable to use for the returned graphic
 * @return - a graphic representing the point
 */
private Graphic generateRoutePoints(final Point p, final BitmapDrawable pin){
  final float offsetY = convertPixelsToDp(getActivity(), pin.getBounds().bottom);
  final PictureMarkerSymbol symbol = new PictureMarkerSymbol(pin);
  symbol.setOffsetY(offsetY);
  return new Graphic(p, symbol);
}
 
开发者ID:Esri,项目名称:nearby-android,代码行数:14,代码来源:MapFragment.java


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