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


Java SimpleLineSymbol类代码示例

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


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

示例1: createLineSymbols

import com.esri.arcgisruntime.symbology.SimpleLineSymbol; //导入依赖的package包/类
/**
 * Creates a list of three SimpleLineSymbols, (blue, red, green).
 */
private void createLineSymbols() {

  lineSymbols = new ArrayList<>();

  // solid blue (0xFF0000FF) simple line symbol
  SimpleLineSymbol blueLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF0000FF, 3);
  lineSymbols.add(blueLineSymbol);

  // solid green (0xFF00FF00) simple line symbol
  SimpleLineSymbol greenLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF00FF00, 3);
  lineSymbols.add(greenLineSymbol);

  // solid red (0xFFFF0000) simple line symbol
  SimpleLineSymbol redLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFFFF0000, 3);
  lineSymbols.add(redLineSymbol);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:20,代码来源:SimpleFillSymbolSample.java

示例2: symbolizeShapefile

import com.esri.arcgisruntime.symbology.SimpleLineSymbol; //导入依赖的package包/类
private void symbolizeShapefile() {

    // create a shapefile feature table from the local data
    ShapefileFeatureTable shapefileFeatureTable = new ShapefileFeatureTable(
        Environment.getExternalStorageDirectory() + getString(R.string.local_folder) + getString(R.string.file_name));

    // use the shapefile feature table to create a feature layer
    FeatureLayer featureLayer = new FeatureLayer(shapefileFeatureTable);

    // create the Symbol
    SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.RED, 1.0f);
    SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.YELLOW, lineSymbol);

    // create the Renderer
    SimpleRenderer renderer = new SimpleRenderer(fillSymbol);

    // set the Renderer on the Layer
    featureLayer.setRenderer(renderer);

    // add the feature layer to the map
    mMap.getOperationalLayers().add(featureLayer);
  }
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:23,代码来源:MainActivity.java

示例3: createPolylineTable

import com.esri.arcgisruntime.symbology.SimpleLineSymbol; //导入依赖的package包/类
/**
 * Creates a PolyLine Feature Collection Table with one PolyLine and adds it to the Feature collection that was passed.
 * 
 * @param featureCollection that the polyline Feature Collection Table will be added to
 */
private void createPolylineTable(FeatureCollection featureCollection) {

  // defines the schema for the geometry's attribute
  List<Field> polylineFields = new ArrayList<>();
  polylineFields.add(Field.createString("Boundary", "Boundary Name", 50));

  // a feature collection table that creates polyline geometry
  FeatureCollectionTable polylineTable = new FeatureCollectionTable(polylineFields, GeometryType.POLYLINE, WGS84);

  // set a default symbol for features in the collection table
  SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.DASH, 0xFF00FF00, 3);
  SimpleRenderer renderer = new SimpleRenderer(lineSymbol);
  polylineTable.setRenderer(renderer);

  // add feature collection table to feature collection
  featureCollection.getTables().add(polylineTable);

  // create feature using the collection table by passing an attribute and geometry
  Map<String, Object> attributes = new HashMap<>();
  attributes.put(polylineFields.get(0).getName(), "AManAPlanACanalPanama");
  PolylineBuilder builder = new PolylineBuilder(WGS84);
  builder.addPoint(new Point(-79.497238, 8.849289, WGS84));
  builder.addPoint(new Point(-80.035568, 9.432302, WGS84));
  Feature addedFeature = polylineTable.createFeature(attributes, builder.toGeometry());

  // add feature to collection table
  polylineTable.addFeatureAsync(addedFeature);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:34,代码来源:FeatureCollectionLayerSample.java

示例4: createPolygonTables

import com.esri.arcgisruntime.symbology.SimpleLineSymbol; //导入依赖的package包/类
/**
 * Creates a Polygon Feature Collection Table with one Polygon and adds it to the Feature collection that was passed.
 * 
 * @param featureCollection that the polygon Feature Collection Table will be added to
 */
private void createPolygonTables(FeatureCollection featureCollection) {

  // defines the schema for the geometry's attribute
  List<Field> polygonFields = new ArrayList<>();
  polygonFields.add(Field.createString("Area", "Area Name", 50));

  // a feature collection table that creates polygon geometry
  FeatureCollectionTable polygonTable = new FeatureCollectionTable(polygonFields, GeometryType.POLYGON, WGS84);

  // set a default symbol for features in the collection table
  SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF0000FF, 2);
  SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.DIAGONAL_CROSS, 0xFF00FFFF, lineSymbol);
  SimpleRenderer renderer = new SimpleRenderer(fillSymbol);
  polygonTable.setRenderer(renderer);

  // add feature collection table to feature collection
  featureCollection.getTables().add(polygonTable);

  // create feature using the collection table by passing an attribute and geometry
  Map<String, Object> attributes = new HashMap<>();
  attributes.put(polygonFields.get(0).getName(), "Restricted area");
  PolygonBuilder builder = new PolygonBuilder(WGS84);
  builder.addPoint(new Point(-79.497238, 8.849289, WGS84));
  builder.addPoint(new Point(-79.337936, 8.638903, WGS84));
  builder.addPoint(new Point(-79.11409, 8.895422, WGS84));
  Feature addedFeature = polygonTable.createFeature(attributes, builder.toGeometry());

  // add feature to collection table
  polygonTable.addFeatureAsync(addedFeature);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:36,代码来源:FeatureCollectionLayerSample.java

示例5: createPolyline

import com.esri.arcgisruntime.symbology.SimpleLineSymbol; //导入依赖的package包/类
/**
 * Creates a Polyline and adds it to a GraphicsOverlay.
 */
private void createPolyline() {

  // create a purple (0xFF800080) simple line symbol
  SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.DASH, 0xFF800080, 4);

  // create a new point collection for polyline
  PointCollection points = new PointCollection(SPATIAL_REFERENCE);

  // create and add points to the point collection
  points.add(new Point(-2.715, 56.061));
  points.add(new Point(-2.6438, 56.079));
  points.add(new Point(-2.638, 56.079));
  points.add(new Point(-2.636, 56.078));
  points.add(new Point(-2.636, 56.077));
  points.add(new Point(-2.637, 56.076));
  points.add(new Point(-2.715, 56.061));

  // create the polyline from the point collection
  Polyline polyline = new Polyline(points);

  // create the graphic with polyline and symbol
  Graphic graphic = new Graphic(polyline, lineSymbol);

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

示例6: createPolygon

import com.esri.arcgisruntime.symbology.SimpleLineSymbol; //导入依赖的package包/类
/**
 * Creates a Polygon and adds it to a GraphicsOverlay.
 */
private void createPolygon() {

  // create a green (0xFF005000) simple line symbol
  SimpleLineSymbol outlineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.DASH, 0xFF005000, 1);
  // create a green (0xFF005000) mesh simple fill symbol
  SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.DIAGONAL_CROSS, 0xFF005000,
      outlineSymbol);

  // create a new point collection for polygon
  PointCollection points = new PointCollection(SPATIAL_REFERENCE);

  // create and add points to the point collection
  points.add(new Point(-2.6425, 56.0784));
  points.add(new Point(-2.6430, 56.0763));
  points.add(new Point(-2.6410, 56.0759));
  points.add(new Point(-2.6380, 56.0765));
  points.add(new Point(-2.6380, 56.0784));
  points.add(new Point(-2.6410, 56.0786));

  // create the polyline from the point collection
  Polygon polygon = new Polygon(points);

  // create the graphic with polyline and symbol
  Graphic graphic = new Graphic(polygon, fillSymbol);

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

示例7: addNestingGround

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

示例8: onCreate

import com.esri.arcgisruntime.symbology.SimpleLineSymbol; //导入依赖的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 topographic basemap
    final ArcGISMap map = new ArcGISMap(Basemap.createTopographic());
    // set the map to be displayed in the mapview
    mMapView.setMap(map);

    // create feature layer with its service feature table
    // create the service feature table
    mServiceFeatureTable = new ServiceFeatureTable(getResources().getString(R.string.sample_service_url));
    // create the feature layer using the service feature table
    mFeaturelayer = new FeatureLayer(mServiceFeatureTable);
    mFeaturelayer.setOpacity(0.8f);
    //override the renderer
    SimpleLineSymbol lineSymbol= new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLACK, 1);
    SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.YELLOW, lineSymbol);
    mFeaturelayer.setRenderer(new SimpleRenderer(fillSymbol));

    // add the layer to the map
    map.getOperationalLayers().add(mFeaturelayer);

    // zoom to a view point of the USA
    mMapView.setViewpointCenterAsync(new Point(-11000000, 5000000, SpatialReferences.getWebMercator()), 100000000);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:31,代码来源:MainActivity.java

示例9: overrideRenderer

import com.esri.arcgisruntime.symbology.SimpleLineSymbol; //导入依赖的package包/类
private void overrideRenderer() {

        // create a new simple renderer for the line feature layer
        SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.rgb(0, 0, 255), 2);
        SimpleRenderer simpleRenderer = new SimpleRenderer(lineSymbol);

        // override the current renderer with the new renderer defined above
        mFeatureLayer.setRenderer(simpleRenderer);
    }
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:10,代码来源:MainActivity.java

示例10: onCreate

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

示例11: onCreate

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

示例12: initialize

import com.esri.arcgisruntime.symbology.SimpleLineSymbol; //导入依赖的package包/类
@FXML
public void initialize() {

  ArcGISMap map = new ArcGISMap(Basemap.createStreets());
  mapView.setMap(map);
  // set mapview to San Diego
  mapView.setViewpoint(new Viewpoint(32.73, -117.14, 60000));

  // create service area task from url
  final String SanDiegoRegion = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/NAServer/ServiceArea";
  serviceAreaTask = new ServiceAreaTask(SanDiegoRegion);
  serviceAreaTask.loadAsync();
  // create default parameters from task
  ListenableFuture<ServiceAreaParameters> parameters = serviceAreaTask.createDefaultParametersAsync();
  parameters.addDoneListener(() -> {
    try {
      serviceAreaParameters = parameters.get();
      serviceAreaParameters.setPolygonDetail(ServiceAreaPolygonDetail.HIGH);
      serviceAreaParameters.setReturnPolygons(true);
      // adding another service area of 2 minutes
      // default parameters have a default service area of 5 minutes
      serviceAreaParameters.getDefaultImpedanceCutoffs().addAll(Arrays.asList(2.0));
    } catch (ExecutionException | InterruptedException e) {
      e.printStackTrace();
    }
  });

  // for displaying graphics to mapview
  serviceAreasOverlay = new GraphicsOverlay();
  facilityOverlay = new GraphicsOverlay();
  barrierOverlay = new GraphicsOverlay();
  mapView.getGraphicsOverlays().addAll(Arrays.asList(serviceAreasOverlay, barrierOverlay, facilityOverlay));

  barrierBuilder = new PolylineBuilder(spatialReference);
  serviceAreaFacilities = new ArrayList<>();

  SimpleLineSymbol outline = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF000000, 3.0f);
  fillSymbols = new ArrayList<>();
  fillSymbols.add(new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0x66FF0000, outline));
  fillSymbols.add(new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0x66FFA500, outline));

  // icon used to display facilities to mapview
  String facilityUrl = "http://static.arcgis.com/images/Symbols/SafetyHealth/Hospital.png";
  PictureMarkerSymbol facilitySymbol = new PictureMarkerSymbol(facilityUrl);
  facilitySymbol.setHeight(30);
  facilitySymbol.setWidth(30);

  // creates facilities and barriers at user's clicked location
  mapView.setOnMouseClicked(e -> {
    if (e.getButton() == MouseButton.PRIMARY && e.isStillSincePress()) {
      // create a point from where the user clicked
      Point2D point = new Point2D(e.getX(), e.getY());
      Point mapPoint = mapView.screenToLocation(point);
      if (btnAddFacility.isSelected()) {
        // create facility from point and display to mapview
        Point servicePoint = new Point(mapPoint.getX(), mapPoint.getY(), spatialReference);
        serviceAreaFacilities.add(new ServiceAreaFacility(servicePoint));
        facilityOverlay.getGraphics().add(new Graphic(servicePoint, facilitySymbol));
      } else if (btnAddBarrier.isSelected()) {
        // create barrier and display to mapview
        barrierBuilder.addPoint(new Point(mapPoint.getX(), mapPoint.getY(), spatialReference));
        barrierOverlay.getGraphics().add(barrierOverlay.getGraphics().size(), new Graphic(barrierBuilder.toGeometry(), outline));
      }
    }
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:67,代码来源:ServiceAreaTaskController.java

示例13: start

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

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);
    scene.getStylesheets().add(getClass().getResource("/css/style.css").toExternalForm());

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

    // create a control panel
    VBox vBoxControl = new VBox(6);
    vBoxControl.setMaxSize(180, 200);
    vBoxControl.getStyleClass().add("panel-region");

    createSymbolFuntionality(vBoxControl);

    final ArcGISMap map = new ArcGISMap(Basemap.createImagery());

    // set initial map view point
    Point point = new Point(-226773, 6550477, SpatialReferences.getWebMercator());
    Viewpoint viewpoint = new Viewpoint(point, 7200); // point, scale
    map.setInitialViewpoint(viewpoint);

    // create a view for this ArcGISMap and set ArcGISMap to it
    mapView = new MapView();
    mapView.setMap(map);

    // creates a line from two points
    PointCollection points = new PointCollection(SpatialReferences.getWebMercator());
    points.add(-226913, 6550477);
    points.add(-226643, 6550477);
    Polyline line = new Polyline(points);

    // creates a solid red (0xFFFF0000) simple line symbol
    lineSymbol = new SimpleLineSymbol(Style.SOLID, 0xFFFF0000, 3);

    // add line with symbol to graphics overlay and add overlay to map view
    GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
    mapView.getGraphicsOverlays().add(graphicsOverlay);
    graphicsOverlay.getGraphics().add(new Graphic(line, lineSymbol));

    // add the map view and control panel to stack pane
    stackPane.getChildren().addAll(mapView, vBoxControl);
    StackPane.setAlignment(vBoxControl, Pos.TOP_LEFT);
    StackPane.setMargin(vBoxControl, new Insets(10, 0, 0, 10));
  } catch (Exception e) {
    // on any error, display the stack trace
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:58,代码来源:SimpleLineSymbolSample.java

示例14: start

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

  StackPane stackPane = new StackPane();
  Scene fxScene = new Scene(stackPane);
  // for adding styling to any controls that are added 
  fxScene.getStylesheets().add(getClass().getResource("/css/style.css").toExternalForm());

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

  // so scene can be visible within application
  ArcGISScene scene = new ArcGISScene(Basemap.createTopographic());
  sceneView = new SceneView();
  sceneView.setArcGISScene(scene);
  stackPane.getChildren().add(sceneView);

  // get us census data as a service feature table
  ServiceFeatureTable statesServiceFeatureTable = new ServiceFeatureTable("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3");

  // creates feature layer from table and add to scene
  final FeatureLayer statesFeatureLayer = new FeatureLayer(statesServiceFeatureTable);
  // feature layer must be rendered dynamically for extrusion to work
  statesFeatureLayer.setRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);
  scene.getOperationalLayers().add(statesFeatureLayer);

  // symbols are used to display features (US states) from table
  SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF000000, 1.0f);
  SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0xFF0000FF, lineSymbol);
  final SimpleRenderer renderer = new SimpleRenderer(fillSymbol);
  //  need to set an extrusion type, BASE HEIGHT extrudes each point from feature individually
  renderer.getSceneProperties().setExtrusionMode(Renderer.SceneProperties.ExtrusionMode.BASE_HEIGHT);
  statesFeatureLayer.setRenderer(renderer);

  // set camera to focus on state features
  Point lookAtPoint = new Point(-10974490, 4814376, 0, SpatialReferences.getWebMercator());
  OrbitLocationCameraController orbitCamera = new OrbitLocationCameraController(lookAtPoint, 10000000);
  sceneView.setCameraController(orbitCamera);

  // create a control panel
  VBox vBoxControl = new VBox();
  vBoxControl.setMaxSize(200, 40);
  vBoxControl.getStyleClass().add("panel-region");
  stackPane.getChildren().add(vBoxControl);
  StackPane.setAlignment(vBoxControl, Pos.TOP_LEFT);
  StackPane.setMargin(vBoxControl, new Insets(10, 0, 0, 10));

  // controls for extruding by total population or by population density
  Button extrusionButton = new Button("Population Density");
  extrusionButton.setOnAction(v -> {
    if (showTotalPopulation) {
      // some feature's population is really big of need to sink it down
      renderer.getSceneProperties().setExtrusionExpression("[POP2007]/ 10");
      extrusionButton.setText("Population Density");
      showTotalPopulation = false;
    } else {
      // density of population is a small value to need to increase it
      renderer.getSceneProperties().setExtrusionExpression("[POP07_SQMI] * 5000");
      extrusionButton.setText("Total Population");
      showTotalPopulation = true;
    }
  });
  extrusionButton.setMaxWidth(Double.MAX_VALUE);
  extrusionButton.fire();
  vBoxControl.getChildren().add(extrusionButton);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:71,代码来源:FeatureLayerExtrusionSample.java

示例15: start

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

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // set title, size, and add scene to stage
    stage.setTitle("Add Graphics with Renderer Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a map with topographic basemap
    ArcGISMap map = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 15.169193, 16.333479, 2);

    // set the map to the view
    mapView = new MapView();
    mapView.setMap(map);

    // create a graphics overlay for displaying point graphic
    GraphicsOverlay pointGraphicOverlay = new GraphicsOverlay();
    // create point geometry
    Point point = new Point(40e5, 40e5, SpatialReferences.getWebMercator());
    // create graphic for point
    Graphic pointGraphic = new Graphic(point);
    // red (0xFFFF0000) diamond point symbol
    SimpleMarkerSymbol pointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.DIAMOND, 0xFFFF0000, 10);
    // create simple renderer
    SimpleRenderer pointRenderer = new SimpleRenderer(pointSymbol);
    // set renderer on graphics overlay
    pointGraphicOverlay.setRenderer(pointRenderer);
    // add graphic to overlay
    pointGraphicOverlay.getGraphics().add(pointGraphic);
    // add graphics overlay to the MapView
    mapView.getGraphicsOverlays().add(pointGraphicOverlay);

    // solid blue (0xFF0000FF) line graphic
    GraphicsOverlay lineGraphicOverlay = new GraphicsOverlay();
    PolylineBuilder lineGeometry = new PolylineBuilder(SpatialReferences.getWebMercator());
    lineGeometry.addPoint(-10e5, 40e5);
    lineGeometry.addPoint(20e5, 50e5);
    Graphic lineGraphic = new Graphic(lineGeometry.toGeometry());
    lineGraphicOverlay.getGraphics().add(lineGraphic);
    SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF0000FF, 5);
    SimpleRenderer lineRenderer = new SimpleRenderer(lineSymbol);
    lineGraphicOverlay.setRenderer(lineRenderer);
    mapView.getGraphicsOverlays().add(lineGraphicOverlay);

    // solid yellow (0xFFFFFF00) polygon graphic
    GraphicsOverlay polygonGraphicOverlay = new GraphicsOverlay();
    PolygonBuilder polygonGeometry = new PolygonBuilder(SpatialReferences.getWebMercator());
    polygonGeometry.addPoint(-20e5, 20e5);
    polygonGeometry.addPoint(20e5, 20e5);
    polygonGeometry.addPoint(20e5, -20e5);
    polygonGeometry.addPoint(-20e5, -20e5);
    Graphic polygonGraphic = new Graphic(polygonGeometry.toGeometry());
    polygonGraphicOverlay.getGraphics().add(polygonGraphic);
    SimpleFillSymbol polygonSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0xFFFFFF00, null);
    SimpleRenderer polygonRenderer = new SimpleRenderer(polygonSymbol);
    polygonGraphicOverlay.setRenderer(polygonRenderer);
    mapView.getGraphicsOverlays().add(polygonGraphicOverlay);

    // add the map view to stack pane
    stackPane.getChildren().add(mapView);
  } catch (Exception e) {
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:72,代码来源:AddGraphicsWithRendererSample.java


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