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

Java GraphicsOverlay类代码示例

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

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



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

示例1: createGraphics

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的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


示例2: onCreate

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的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 BasemapType topographic
    ArcGISMap map = new ArcGISMap(Basemap.Type.OCEANS, 56.075844, -2.681572, 11);
    // set the map to be displayed in this view
    mMapView.setMap(map);
    // add graphics overlay to MapView.
    GraphicsOverlay graphicsOverlay = addGraphicsOverlay(mMapView);
    //add some buoy positions to the graphics overlay
    addBuoyPoints(graphicsOverlay);
    //add boat trip polyline to graphics overlay
    addBoatTrip(graphicsOverlay);
    //add nesting ground polygon to graphics overlay
    addNestingGround(graphicsOverlay);
    //add text symbols and points to graphics overlay
    addText(graphicsOverlay);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:23,代码来源:MainActivity.java


示例3: addBuoyPoints

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的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


示例4: addText

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的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


示例5: addGraphicsOverlay

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的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


示例6: addLayer

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的package包/类
/**
 * Add an operational layer to the map
 * @param layer - A Layer to add
 */
@Override public void addLayer(final Layer layer) {
  // Create and add layers that need to be visible in the map
  mGraphicOverlay  = new GraphicsOverlay();
  mMapView.getGraphicsOverlays().add(mGraphicOverlay);
  mMap.getOperationalLayers().add(layer);
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:11,代码来源:MapFragment.java


示例7: initialize

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的package包/类
public void initialize() {

    // create a scene and add a basemap to it
    ArcGISScene scene = new ArcGISScene();
    scene.setBasemap(Basemap.createImagery());

    // add the SceneView to the stack pane
    sceneView.setArcGISScene(scene);

    // add a camera and initial camera position
    Point point = new Point(83.9, 28.4, 1000, SpatialReferences.getWgs84());
    Camera camera = new Camera(point, 1000, 0, 50, 0);
    sceneView.setViewpointCamera(camera);

    // create a graphics overlay
    GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
    graphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.RELATIVE);
    sceneView.getGraphicsOverlays().add(graphicsOverlay);

    // add renderer using rotation expressions
    SimpleRenderer renderer = new SimpleRenderer();
    renderer.getSceneProperties().setHeadingExpression("[HEADING]");
    renderer.getSceneProperties().setPitchExpression("[PITCH]");
    graphicsOverlay.setRenderer(renderer);

    // create a red (0xFFFF0000) cone graphic
    SimpleMarkerSceneSymbol coneSymbol = SimpleMarkerSceneSymbol.createCone(0xFFFF0000, 100, 100);
    coneSymbol.setPitch(-90);  // correct symbol's default pitch
    Graphic cone = new Graphic(new Point(83.9, 28.41, 200, SpatialReferences.getWgs84()), coneSymbol);
    graphicsOverlay.getGraphics().add(cone);

    // bind attribute values to sliders
    headingSlider.valueProperty().addListener(o -> cone.getAttributes().put("HEADING", headingSlider.getValue()));
    pitchSlider.valueProperty().addListener(o -> cone.getAttributes().put("PITCH", pitchSlider.getValue()));
  }
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:36,代码来源:ScenePropertiesExpressionsController.java


示例8: addGraphicsOverlay

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的package包/类
private GraphicsOverlay addGraphicsOverlay(MapView mapView) {
    //create the graphics overlay
    GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
    //add the overlay to the map view
    mapView.getGraphicsOverlays().add(graphicsOverlay);
    return graphicsOverlay;
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:8,代码来源:MainActivity.java


示例9: addNestingGround

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的package包/类
private void addNestingGround(GraphicsOverlay graphicOverlay) {
    //define the polygon for the nesting ground
    Polygon nestingGround = getNestingGroundGeometry();
    //define the fill symbol and outline
    SimpleLineSymbol outlineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.DASH, Color.rgb(0, 0, 128), 1);
    SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.DIAGONAL_CROSS, Color.rgb(0, 80, 0), outlineSymbol);
    //define graphic
    Graphic nestingGraphic = new Graphic(nestingGround,fillSymbol);
    //add to graphics overlay
    graphicOverlay.getGraphics().add(nestingGraphic);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:12,代码来源:MainActivity.java


示例10: onCreate

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //initialize reverse geocode params
    mReverseGeocodeParameters = new ReverseGeocodeParameters();
    mReverseGeocodeParameters.setMaxResults(1);
    mReverseGeocodeParameters.getResultAttributeNames().add("*");
    //retrieve the MapView from layout
    mMapView = (MapView) findViewById(R.id.mapView);
    //add route and marker overlays to map view
    mMarkerGraphicsOverlay = new GraphicsOverlay();
    mRouteGraphicsOverlay = new GraphicsOverlay();
    mMapView.getGraphicsOverlays().add(mRouteGraphicsOverlay);
    mMapView.getGraphicsOverlays().add(mMarkerGraphicsOverlay);
    // build the file path to access the mobile map package
    String filePathMMPk = buildMMPkPath();
    // add the map from the mobile map package to the MapView
    loadMobileMapPackage(filePathMMPk);
    mMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, mMapView) {

        @Override
        public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
            Log.d(TAG, "onSingleTapConfirmed: " + motionEvent.toString());
            // get the point that was clicked and convert it to a point in map coordinates
            android.graphics.Point screenPoint = new android.graphics.Point(
                    Math.round(motionEvent.getX()),
                    Math.round(motionEvent.getY()));
            // create a map point from screen point
            Point mapPoint = mMapView.screenToLocation(screenPoint);
            geoView(screenPoint, mapPoint);
            return true;
        }
    });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:36,代码来源:MobileMapViewActivity.java


示例11: onCreate

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的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.createImagery());

    // create an initial viewpoint with a point and scale
    Point point = new Point(-226773, 6550477, SpatialReferences.getWebMercator());
    Viewpoint vp = new Viewpoint(point, 7500);

    // set initial map extent
    map.setInitialViewpoint(vp);

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

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

    //[DocRef: Name=Point graphic with symbol, Category=Fundamentals, Topic=Symbols and Renderers]
    //create a simple marker symbol
    SimpleMarkerSymbol symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 12); //size 12, style of circle

    //add a new graphic with a new point geometry
    Point graphicPoint = new Point(-226773, 6550477, SpatialReferences.getWebMercator());
    Graphic graphic = new Graphic(graphicPoint, symbol);
    graphicsOverlay.getGraphics().add(graphic);
    //[DocRef: END]

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


示例12: onCreate

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

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

  // create a map with the BasemapType topographic
  final ArcGISMap mMap = new ArcGISMap(Basemap.createTopographic());

  // set the map to be displayed in this view
  mMapView.setMap(mMap);

  // create color and symbols for drawing graphics
  SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.TRIANGLE, Color.BLUE, 14);
  SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.CROSS, Color.BLUE, null);
  SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 3);

  // add a graphic of point, multipoint, polyline and polygon.
  GraphicsOverlay overlay = new GraphicsOverlay();
  mMapView.getGraphicsOverlays().add(overlay);
  overlay.getGraphics().add(new Graphic(createPolygon(), fillSymbol));
  overlay.getGraphics().add(new Graphic(createPolyline(), lineSymbol));
  overlay.getGraphics().add(new Graphic(createMultipoint(), markerSymbol));
  overlay.getGraphics().add(new Graphic(createPoint(), markerSymbol));

  // use the envelope to set the map viewpoint
  mMapView.setViewpointGeometryAsync(createEnvelope(), getResources().getDimension(R.dimen.viewpoint_padding));

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


示例13: addGraphic

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的package包/类
/**
 * Add a new Graphic to a GraphicsOverlay in the MapView contained in the layout. Creates and adds a
 * new GraphicsOverlay to the MapView's collection, if required.
 *
 * @param graphicGeometry a Point to be used as the Geometry of the new Graphic
 * @param color           integer representing the color of the new Symbol
 * @return the Graphic which was added to an overlay
 */
private Graphic addGraphic(Point graphicGeometry, int color, SimpleMarkerSymbol.Style style) {
  if (mMapView.getGraphicsOverlays().size() < 1) {
    mMapView.getGraphicsOverlays().add(new GraphicsOverlay());
  }
  SimpleMarkerSymbol sym = new SimpleMarkerSymbol(style, color, 15.0f);
  Graphic g = new Graphic(graphicGeometry, sym);
  mMapView.getGraphicsOverlays().get(0).getGraphics().add(g);
  return g;
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:18,代码来源:MainActivity.java


示例14: onCreate

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

  // define symbols
  mPointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.SQUARE, 0xFFFF0000, 20);
  mLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFFFF8800, 4);
  mFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.CROSS, 0x40FFA9A9, mLineSymbol);

  // inflate map view from layout
  mMapView = findViewById(R.id.mapView);
  // create a map with the Basemap Type topographic
  ArcGISMap map = new ArcGISMap(Basemap.Type.LIGHT_GRAY_CANVAS, 34.056295, -117.195800, 16);
  // set the map to be displayed in this view
  mMapView.setMap(map);

  mGraphicsOverlay = new GraphicsOverlay();
  mMapView.getGraphicsOverlays().add(mGraphicsOverlay);

  // create a new sketch editor and add it to the map view
  mSketchEditor = new SketchEditor();
  mMapView.setSketchEditor(mSketchEditor);

  // get buttons from layouts
  mPointButton = findViewById(R.id.pointButton);
  mMultiPointButton = findViewById(R.id.pointsButton);
  mPolylineButton = findViewById(R.id.polylineButton);
  mPolygonButton = findViewById(R.id.polygonButton);
  mFreehandLineButton = findViewById(R.id.freehandLineButton);
  mFreehandPolygonButton = findViewById(R.id.freehandPolygonButton);

  // add click listeners
  mPointButton.setOnClickListener(view -> createModePoint());
  mMultiPointButton.setOnClickListener(view -> createModeMultipoint());
  mPolylineButton.setOnClickListener(view -> createModePolyline());
  mPolygonButton.setOnClickListener(view -> createModePolygon());
  mFreehandLineButton.setOnClickListener(view -> createModeFreehandLine());
  mFreehandPolygonButton.setOnClickListener(view -> createModeFreehandPolygon());
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:41,代码来源:MainActivity.java


示例15: onCreate

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

  mInputGraphicsOverlay = new GraphicsOverlay();
  mResultGraphicsOverlay = new GraphicsOverlay();

  // inflate MapView from layout
  mMapView = (MapView) findViewById(R.id.mapView);
  // create a map with the BasemapType topographic
  ArcGISMap map = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 45.3790902612337, 6.84905317262762, 12);
  // set the map to be displayed in this view
  mMapView.setMap(map);

  // renderer for graphics overlays
  SimpleMarkerSymbol pointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 10);
  SimpleRenderer renderer = new SimpleRenderer(pointSymbol);
  mInputGraphicsOverlay.setRenderer(renderer);

  int fillColor = Color.argb(120, 226, 119, 40);
  FillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, fillColor, null);
  mResultGraphicsOverlay.setRenderer(new SimpleRenderer(fillSymbol));

  // add graphics overlays to the map view
  mMapView.getGraphicsOverlays().add(mResultGraphicsOverlay);
  mMapView.getGraphicsOverlays().add(mInputGraphicsOverlay);

  mGeoprocessingTask = new GeoprocessingTask(getString(R.string.viewshed_service));

  mMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(getApplicationContext(), mMapView) {
    @Override public boolean onSingleTapConfirmed(MotionEvent e) {
      android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY()));
      Point mapPoint = mMapView.screenToLocation(screenPoint);
      addGraphicForPoint(mapPoint);
      calculateViewshedAt(mapPoint);
      return super.onSingleTapConfirmed(e);
    }
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:41,代码来源:MainActivity.java


示例16: initialize

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的package包/类
public void initialize() {
  // create a basemap from local data (a tile package)
  TileCache tileCache = new TileCache(tilePackageFilePath); // "/data/tiled
                                                            // packages/RedlandsBasemap.tpk"
  Basemap offlineBasemap = new Basemap(new ArcGISTiledLayer(tileCache));

  // create a map
  map = new ArcGISMap(offlineBasemap);
  mapView.setMap(map);

  // add feature data
  ServiceFeatureTable featureTable = new ServiceFeatureTable(LAYER_URL);
  featureLayer = new FeatureLayer(featureTable);
  map.getOperationalLayers().add(featureLayer);

  // create overlay for temporary graphics
  geometryResult = new GraphicsOverlay();
  mapView.getGraphicsOverlays().add(geometryResult);
  routeResult = new GraphicsOverlay();
  mapView.getGraphicsOverlays().add(routeResult);

  // set functions to execute when map is clicked and mouse moved over the
  // map
  mapView.setOnMouseClicked(mapClickEvent -> {
    if (functionOnMapClick != null) {
      functionOnMapClick.apply(mapClickEvent);
    }
  });
  mapView.setOnMouseMoved(mapMoveEvent -> {
    if (functionOnMouseMove != null) {
      functionOnMouseMove.apply(mapMoveEvent);
    }
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:35,代码来源:ResponderAppController.java


示例17: start

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {

    // create stack pane and JavaFX app scene
    StackPane stackPane = new StackPane();
    Scene fxScene = new Scene(stackPane);

    // set title, size, and add JavaFX scene to stage
    stage.setTitle("Symbols Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(fxScene);
    stage.show();

    // create a scene and add a basemap to it
    ArcGISScene scene = new ArcGISScene();
    scene.setBasemap(Basemap.createImagery());

    // add the SceneView to the stack pane
    sceneView = new SceneView();
    sceneView.setArcGISScene(scene);
    stackPane.getChildren().add(sceneView);

    // add a camera and initial camera position
    Camera camera = new Camera(29, 45, 6000, 0, 0, 0);
    sceneView.setViewpointCamera(camera);
    Point cameraLocation = camera.getLocation();

    // add base surface for elevation data
    ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(ELEVATION_IMAGE_SERVICE);
    Surface surface = new Surface();
    surface.getElevationSources().add(elevationSource);
    scene.setBaseSurface(surface);

    // add graphics overlay(s)
    GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
    graphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.ABSOLUTE);
    sceneView.getGraphicsOverlays().add(graphicsOverlay);

    // create graphics for each type of symbol
    AtomicInteger counter = new AtomicInteger(0);
    double x = 44.975;
    double y = 29;
    double z = 500;
    Stream.of(SimpleMarkerSceneSymbol.Style.values()).map(style -> {
      int color;
      switch (style) {
        case CONE:
          color = 0xFFFF0000; // red
          break;
        case TETRAHEDRON:
          color = 0xFF00FF00; // green
          break;
        case SPHERE:
          color = 0xFF0000FF; // blue
          break;
        case CYLINDER:
          color = 0xFFFF00FF; // purple
          break;
        case DIAMOND:
          color = 0xFF00FFFF; // turquoise
          break;
        case CUBE:
        default:
          color = 0xFFFFFFFF; // white
      }
      SimpleMarkerSceneSymbol symbol = new SimpleMarkerSceneSymbol(style, color, 200, 200, 200,
          SceneSymbol.AnchorPosition.CENTER);
      int position = counter.getAndIncrement();
      return new Graphic(new Point(x + 0.01 * position, y, z, cameraLocation.getSpatialReference()), symbol);
    }).collect(Collectors.toCollection(graphicsOverlay::getGraphics));

  } catch (Exception e) {
    // on any error, display the stack trace
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:80,代码来源:SymbolsSample.java


示例18: start

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {

    // create stack pane and JavaFX app scene
    StackPane stackPane = new StackPane();
    Scene fxScene = new Scene(stackPane);

    // set title, squareSize, and add JavaFX scene to stage
    stage.setTitle("Extrude Graphics Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(fxScene);
    stage.show();

    // create a scene and add a basemap to it
    ArcGISScene scene = new ArcGISScene();
    scene.setBasemap(Basemap.createImagery());

    // add the SceneView to the stack pane
    sceneView = new SceneView();
    sceneView.setArcGISScene(scene);
    stackPane.getChildren().add(sceneView);

    Camera camera = new Camera(28.4, 83, 10000, 10.0, 80.0, 0);
    sceneView.setViewpointCamera(camera);

    // add base surface for elevation data
    Surface surface = new Surface();
    surface.getElevationSources().add(new ArcGISTiledElevationSource(ELEVATION_IMAGE_SERVICE));
    scene.setBaseSurface(surface);

    // add a graphics overlay
    GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
    graphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.DRAPED);

    // set renderer with extrusion property
    SimpleRenderer renderer = new SimpleRenderer();
    SceneProperties renderProperties = renderer.getSceneProperties();
    renderProperties.setExtrusionMode(SceneProperties.ExtrusionMode.BASE_HEIGHT);
    renderProperties.setExtrusionExpression("[HEIGHT]");
    graphicsOverlay.setRenderer(renderer);

    // setup graphic positions
    double squareSize = 0.01;
    double maxHeight = 10000.0;
    double x = camera.getLocation().getX();
    double y = camera.getLocation().getY() + 0.2;
    List<Point> points = IntStream.range(0, 100).mapToObj(i -> new Point(i / 10 * squareSize + x, i % 10 *
        squareSize + y)).collect(Collectors.toList());

    // create and style graphics
    points.forEach(p -> {
      double z = (int) (maxHeight * Math.random());
      int color = ColorUtil.colorToArgb(Color.color(1.0 / maxHeight * z, 0, 0.5, 1));
      Polygon polygon = new Polygon(new PointCollection(Arrays.asList(new Point(p.getX(), p.getY(), z), new Point(p
          .getX() + squareSize, p.getY(), z), new Point(p.getX() + squareSize, p.getY() + squareSize, z), new Point(p
              .getX(), p.getY() + squareSize, z))));
      Graphic graphic = new Graphic(polygon);
      graphic.getAttributes().put("HEIGHT", z);
      graphic.setSymbol(new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, color, null));
      graphicsOverlay.getGraphics().add(graphic);
    });

    sceneView.getGraphicsOverlays().add(graphicsOverlay);
  } catch (Exception e) {
    // on any error, display the stack trace
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:72,代码来源:ExtrudeGraphicsSample.java


示例19: start

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {

    // create stack pane and JavaFX app scene
    StackPane stackPane = new StackPane();
    Scene fxScene = new Scene(stackPane);

    // set title, size, and add JavaFX scene to stage
    stage.setTitle("Distance Composite Symbol Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(fxScene);
    stage.show();

    // create a scene and add a basemap to it
    ArcGISScene scene = new ArcGISScene();
    scene.setBasemap(Basemap.createImagery());

    // add the SceneView to the stack pane
    sceneView = new SceneView();
    sceneView.setArcGISScene(scene);
    stackPane.getChildren().addAll(sceneView);

    // add base surface for elevation data
    Surface surface = new Surface();
    surface.getElevationSources().add(new ArcGISTiledElevationSource(ELEVATION_IMAGE_SERVICE));
    scene.setBaseSurface(surface);

    // add a graphics overlay
    GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
    graphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.RELATIVE);
    sceneView.getGraphicsOverlays().add(graphicsOverlay);

    // set up the different symbols
    int red = 0xFFFF0000;
    SimpleMarkerSymbol circleSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, red, 10);
    SimpleMarkerSceneSymbol coneSymbol = SimpleMarkerSceneSymbol.createCone(red, 3, 10);
    coneSymbol.setPitch(-90);
    coneSymbol.setAnchorPosition(AnchorPosition.CENTER);
    String modelURI = new File("./samples-data/bristol/Collada/Bristol.dae").getAbsolutePath();
    ModelSceneSymbol modelSymbol = new ModelSceneSymbol(modelURI, 1.0);
    modelSymbol.loadAsync();

    // set up the distance composite symbol
    DistanceCompositeSceneSymbol compositeSymbol = new DistanceCompositeSceneSymbol();
    compositeSymbol.getRangeCollection().add(new DistanceCompositeSceneSymbol.Range(modelSymbol, 0, 100));
    compositeSymbol.getRangeCollection().add(new DistanceCompositeSceneSymbol.Range(coneSymbol, 100, 500));
    compositeSymbol.getRangeCollection().add(new DistanceCompositeSceneSymbol.Range(circleSymbol, 500, 0));

    // create graphic
    Point aircraftPosition = new Point(-2.708471, 56.096575, 5000, SpatialReferences.getWgs84());
    Graphic aircraftGraphic = new Graphic(aircraftPosition, compositeSymbol);
    // add graphic to graphics overlay
    graphicsOverlay.getGraphics().add(aircraftGraphic);

    // add a camera and initial camera position
    Camera camera = new Camera(aircraftPosition, 20, 0, 70.0, 0.0);
    sceneView.setViewpointCamera(camera);
  } catch (Exception e) {
    // on any error, display the stack trace.
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:66,代码来源:DistanceCompositeSymbolSample.java


示例20: start

import com.esri.arcgisruntime.mapping.view.GraphicsOverlay; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {

    // create stack pane and JavaFX app scene
    StackPane stackPane = new StackPane();
    Scene fxScene = new Scene(stackPane);

    // set title, size, and add JavaFX scene to stage
    stage.setTitle("Elevation Mode Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(fxScene);
    stage.show();

    // create a scene and add a basemap to it
    ArcGISScene scene = new ArcGISScene();
    scene.setBasemap(Basemap.createImagery());

    // add the SceneView to the stack pane
    sceneView = new SceneView();
    sceneView.setArcGISScene(scene);
    stackPane.getChildren().add(sceneView);

    // add a camera and initial camera position
    Camera camera = new Camera(53.04, -4.04, 1300, 0, 90.0, 0);
    sceneView.setViewpointCamera(camera);

    // add base surface for elevation data
    Surface surface = new Surface();
    surface.getElevationSources().add(new ArcGISTiledElevationSource(ELEVATION_IMAGE_SERVICE));
    scene.setBaseSurface(surface);

    // create overlays with elevation modes
    GraphicsOverlay drapedOverlay = new GraphicsOverlay();
    drapedOverlay.getSceneProperties().setSurfacePlacement(SurfacePlacement.DRAPED);
    sceneView.getGraphicsOverlays().add(drapedOverlay);
    GraphicsOverlay relativeOverlay = new GraphicsOverlay();
    relativeOverlay.getSceneProperties().setSurfacePlacement(SurfacePlacement.RELATIVE);
    sceneView.getGraphicsOverlays().add(relativeOverlay);
    GraphicsOverlay absoluteOverlay = new GraphicsOverlay();
    absoluteOverlay.getSceneProperties().setSurfacePlacement(SurfacePlacement.ABSOLUTE);
    sceneView.getGraphicsOverlays().add(absoluteOverlay);

    // create point for graphic location
    Point point = new Point(-4.04, 53.06, 1000, camera.getLocation().getSpatialReference());

    // create a red (0xFFFF0000) circle symbol
    SimpleMarkerSymbol circleSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFFFF0000, 10);

    // create a text symbol for each elevation mode
    TextSymbol drapedText = new TextSymbol(10, "DRAPED", 0xFFFFFFFF, HorizontalAlignment.LEFT,
        VerticalAlignment.MIDDLE);
    TextSymbol relativeText = new TextSymbol(10, "RELATIVE", 0xFFFFFFFF, HorizontalAlignment.LEFT,
        VerticalAlignment.MIDDLE);
    TextSymbol absoluteText = new TextSymbol(10, "ABSOLUTE", 0xFFFFFFFF, HorizontalAlignment.LEFT,
        VerticalAlignment.MIDDLE);

    // add the point graphic and text graphic to the corresponding graphics
    // overlay
    drapedOverlay.getGraphics().add(new Graphic(point, circleSymbol));
    drapedOverlay.getGraphics().add(new Graphic(point, drapedText));

    relativeOverlay.getGraphics().add(new Graphic(point, circleSymbol));
    relativeOverlay.getGraphics().add(new Graphic(point, relativeText));

    absoluteOverlay.getGraphics().add(new Graphic(point, circleSymbol));
    absoluteOverlay.getGraphics().add(new Graphic(point, absoluteText));

  } catch (Exception e) {
    // on any error, display the stack trace
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:76,代码来源:ElevationModeSample.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java HashCode类代码示例发布时间:2022-05-23
下一篇:
Java Table类代码示例发布时间: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