private Feature getFeature(GeoPlace place, DataID id, Fields fields) { BaseFeature feat = new BaseFeature(); feat.setFields(fields); feat.setDataID(id); Point point = new Point(place.x, place.y); String fieldName; for (int i = 0; i < fields.size(); i++) { if (fields.getField(i).getName().equals("Name")) { feat.setValue(1, place.name); } else if (fields.getField(i).isShape()) { feat.setValue(0, point); } else { // This will never occur as long as the fields parameter is the // result of a call to BaseFields.intersect (perfomed by calling code) throw new IllegalArgumentException("Requested Field not in dataset"); } } return feat; }
void jButton1_actionPerformed(ActionEvent e) { try { flayer = (com.esri.mo2.map.dpy.FeatureLayer) layer2.getLayer(); } catch (Exception ex) { ex.printStackTrace(); } Fields flds = flayer.getFeatureClass().getFields(); int intF = flds.findField("ROUTE"); Field fld = flds.getField(intF); com.esri.mo2.map.draw.BaseSimpleLabelRenderer slr = new com.esri.mo2.map.draw.BaseSimpleLabelRenderer(); slr.setLabelField(fld); com.esri.mo2.map.draw.RasterShieldSymbol rsym = new com.esri.mo2.map.draw.RasterShieldSymbol(); rsym.setImageString("C:/ESRI/MOJ20/Samples/DevGuide/ch06_Symbology/Shield.gif"); rsym.setFont(new java.awt.Font("Times Roman", java.awt.Font.BOLD, 15)); rsym.setLineLabelPosition(com.esri.mo2.map.lbl.LabelEngine.LE_PLACEONTOP); slr.setSymbol(rsym); flayer.setLabelRenderer(slr); map1.redraw(); }