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

Java SimpleLineSymbol类代码示例

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

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



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


示例16: addBoatTrip

import com.esri.arcgisruntime.symbology.SimpleLineSymbol; //导入依赖的package包/类
private void addBoatTrip(GraphicsOverlay graphicOverlay) {
    //define a polyline for the boat trip
    Polyline boatRoute = getBoatTripGeometry();
    //define a line symbol
    SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.DASH, Color.rgb(128, 0, 128), 4);
    //create the graphic
    Graphic boatTripGraphic = new Graphic(boatRoute, lineSymbol);
    //add to the graphic overlay
    graphicOverlay.getGraphics().add(boatTripGraphic);
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:11,代码来源:MainActivity.java


示例17: onCreate

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

  // set flag for showing total population or population density
  showTotalPopulation = true;

  // inflate population type toggle button
  final Button togglePopButton = findViewById(R.id.toggle_button);

  // get us census data as a service feature table
  ServiceFeatureTable statesServiceFeatureTable = new ServiceFeatureTable(
      getResources().getString(R.string.us_census_feature_service));

  // add the service feature table to a feature layer
  final FeatureLayer statesFeatureLayer = new FeatureLayer(statesServiceFeatureTable);
  // set the feature layer to render dynamically to allow extrusion
  statesFeatureLayer.setRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);

  // create a scene and add it to the scene view
  ArcGISScene scene = new ArcGISScene(Basemap.createImagery());
  SceneView sceneView = findViewById(R.id.sceneView);
  sceneView.setScene(scene);

  // add the feature layer to the scene
  scene.getOperationalLayers().add(statesFeatureLayer);

  // define line and fill symbols for a simple renderer
  SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLACK, 1.0f);
  SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.BLUE, lineSymbol);
  final SimpleRenderer renderer = new SimpleRenderer(fillSymbol);
  // set renderer extrusion mode to base height, which includes base height of each vertex in calculating z values
  renderer.getSceneProperties().setExtrusionMode(Renderer.SceneProperties.ExtrusionMode.BASE_HEIGHT);
  // set the simple renderer to the feature layer
  statesFeatureLayer.setRenderer(renderer);

  // define a look at point for the camera at geographical center of the continental US
  Point lookAtPoint = new Point(-10974490, 4814376, 0, SpatialReferences.getWebMercator());
  // add a camera and set it to orbit the look at point
  Camera camera = new Camera(lookAtPoint, 20000000, 0, 55, 0);
  OrbitLocationCameraController orbitCamera = new OrbitLocationCameraController(lookAtPoint, 20000000);
  sceneView.setCameraController(orbitCamera);
  sceneView.setViewpointCamera(camera);

  // set button listener
  togglePopButton.setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View v) {
      // set extrusion properties to either show total population or population density based on flag
      if (showTotalPopulation) {
        // divide total population by 10 to make data legible
        renderer.getSceneProperties().setExtrusionExpression("[POP2007] / 10");
        // change text of button to total pop
        togglePopButton.setText(R.string.total_pop);
        showTotalPopulation = false;
      } else {
        // multiple population density by 5000 to make data legible
        renderer.getSceneProperties().setExtrusionExpression("[POP07_SQMI] * 5000");
        // change text of button to pop density
        togglePopButton.setText(R.string.density_pop);
        showTotalPopulation = true;
      }
    }
  });
  // click to set initial state
  togglePopButton.performClick();
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:68,代码来源:MainActivity.java


示例18: 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
    ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

    //[DocRef: Name=Unique Value Renderer, Topic=Symbols and Renderers, Category=Fundamentals]
    // Create service feature table
    ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(getResources().getString(R.string.sample_service_url));

    // Create the feature layer using the service feature table
    FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);

    // Override the renderer of the feature layer with a new unique value renderer
    UniqueValueRenderer uniqueValueRenderer = new UniqueValueRenderer();
    // Set the field to use for the unique values
    uniqueValueRenderer.getFieldNames().add("STATE_ABBR"); //You can add multiple fields to be used for the renderer in the form of a list, in this case we are only adding a single field

    // Create the symbols to be used in the renderer
    SimpleFillSymbol defaultFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.NULL, Color.BLACK, new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.GRAY, 2));
    SimpleFillSymbol californiaFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.RED, new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.RED, 2));
    SimpleFillSymbol arizonaFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.GREEN, new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.GREEN, 2));
    SimpleFillSymbol nevadaFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID,Color.BLUE, new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 2));

    // Set default symbol
    uniqueValueRenderer.setDefaultSymbol(defaultFillSymbol);
    uniqueValueRenderer.setDefaultLabel("Other");

    // Set value for california
    List<Object> californiaValue = new ArrayList<>();
    // You add values associated with fields set on the unique value renderer.
    // If there are multiple values, they should be set in the same order as the fields are set
    californiaValue.add("CA");
    uniqueValueRenderer.getUniqueValues().add(new UniqueValueRenderer.UniqueValue("California", "State of California", californiaFillSymbol, californiaValue));

    // Set value for arizona
    List<Object> arizonaValue = new ArrayList<>();
    // You add values associated with fields set on the unique value renderer.
    // If there are multiple values, they should be set in the same order as the fields are set
    arizonaValue.add("AZ");
    uniqueValueRenderer.getUniqueValues().add(new UniqueValueRenderer.UniqueValue("Arizona", "State of Arizona", arizonaFillSymbol, arizonaValue));

    // Set value for nevada
    List<Object> nevadaValue = new ArrayList<>();
    // You add values associated with fields set on the unique value renderer.
    // If there are multiple values, they should be set in the same order as the fields are set
    nevadaValue.add("NV");
    uniqueValueRenderer.getUniqueValues().add(new UniqueValueRenderer.UniqueValue("Nevada", "State of Nevada", nevadaFillSymbol, nevadaValue));

    // Set the renderer on the feature layer
    featureLayer.setRenderer(uniqueValueRenderer);
    //[DocRef: END]

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

    map.setInitialViewpoint(new Viewpoint(new Envelope(-13893029.0, 3573174.0, -12038972.0, 5309823.0, SpatialReferences.getWebMercator())));

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

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


示例19: addGraphicsOverlay

import com.esri.arcgisruntime.symbology.SimpleLineSymbol; //导入依赖的package包/类
private void addGraphicsOverlay(){
    // point graphic
    Point pointGeometry = new Point(40e5, 40e5, SpatialReferences.getWebMercator());
    // red diamond point symbol
    SimpleMarkerSymbol pointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.DIAMOND, Color.RED, 10);
    // create graphic for point
    Graphic pointGraphic = new Graphic(pointGeometry);
    // create a graphic overlay for the point
    GraphicsOverlay pointGraphicOverlay = new GraphicsOverlay();
    // create simple renderer
    SimpleRenderer pointRenderer = new SimpleRenderer(pointSymbol);
    pointGraphicOverlay.setRenderer(pointRenderer);
    // add graphic to overlay
    pointGraphicOverlay.getGraphics().add(pointGraphic);
    // add graphics overlay to the MapView
    mMapView.getGraphicsOverlays().add(pointGraphicOverlay);

    // line graphic
    PolylineBuilder lineGeometry = new PolylineBuilder(SpatialReferences.getWebMercator());
    lineGeometry.addPoint(-10e5, 40e5);
    lineGeometry.addPoint(20e5, 50e5);
    // solid blue line symbol
    SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 5);
    // create graphic for polyline
    Graphic lineGraphic = new Graphic(lineGeometry.toGeometry());
    // create graphic overlay for polyline
    GraphicsOverlay lineGraphicOverlay = new GraphicsOverlay();
    // create simple renderer
    SimpleRenderer lineRenderer = new SimpleRenderer(lineSymbol);
    // add graphic to overlay
    lineGraphicOverlay.setRenderer(lineRenderer);
    // add graphic to overlay
    lineGraphicOverlay.getGraphics().add(lineGraphic);
    // add graphics overlay to the MapView
    mMapView.getGraphicsOverlays().add(lineGraphicOverlay);

    //polygon graphic
    PolygonBuilder polygonGeometry = new PolygonBuilder(SpatialReferences.getWebMercator());
    polygonGeometry.addPoint(-20e5, 20e5);
    polygonGeometry.addPoint(20e5, 20e5);
    polygonGeometry.addPoint(20e5, -20e5);
    polygonGeometry.addPoint(-20e5, -20e5);
    // solid yellow polygon symbol
    SimpleFillSymbol polygonSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.YELLOW, null);
    // create graphic for polygon
    Graphic polygonGraphic = new Graphic(polygonGeometry.toGeometry());
    // create graphic overlay for polygon
    GraphicsOverlay polygonGraphicOverlay = new GraphicsOverlay();
    // create simple renderer
    SimpleRenderer polygonRenderer = new SimpleRenderer(polygonSymbol);
    // add graphic to overlay
    polygonGraphicOverlay.setRenderer(polygonRenderer);
    // add graphic to overlay
    polygonGraphicOverlay.getGraphics().add(polygonGraphic);
    // add graphics overlay to MapView
    mMapView.getGraphicsOverlays().add(polygonGraphicOverlay);

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


示例20: SketchGraphicsOverlay

该文章已有0人参与评论

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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