本文整理汇总了Java中com.esri.core.map.Graphic类的典型用法代码示例。如果您正苦于以下问题:Java Graphic类的具体用法?Java Graphic怎么用?Java Graphic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Graphic类属于com.esri.core.map包,在下文中一共展示了Graphic类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: add
import com.esri.core.map.Graphic; //导入依赖的package包/类
private void add(List<Cluster<ClusterableLocation>> clusters) {
int max = getMax(clusters);
for (Cluster<ClusterableLocation> cluster : clusters) {
Geometry geometry = null;
Symbol symbol = null;
Color color = cluster.getPoints().size() == max ? Color.RED : Color.GRAY;
ClusterType thisClusterType = cluster.getPoints().size() < 2 ? ClusterType.POINT : clusterType;
switch (thisClusterType) {
default:
case POINT:
geometry = getCenter(cluster);
symbol = createPointSymbol(color, cluster.getPoints().size());
break;
case BOUNDING_RECTANGLE:
geometry = getBoundingRectangle(cluster);
symbol = createPolygonSymbol(color, cluster.getPoints().size());
break;
case CONVEX_HULL:
geometry = getConvexHull(cluster);
symbol = createPolygonSymbol(color, cluster.getPoints().size());
break;
};
addGraphic(new Graphic(geometry, symbol));
}
}
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:26,代码来源:ClusterLayer.java
示例2: setIdentifyPoint
import com.esri.core.map.Graphic; //导入依赖的package包/类
/**
* Sets the point that was used for the identify operation, for display purposes.
* Ignored if null.
* @param pt The point that was used for the identify operation, for display
* purposes. Ignored if null.
*/
public void setIdentifyPoint(Point pt) {
identifyPoint = pt;
if (null != pt) {
graphicsLayer.setVisible(true);
if (!isGraphicsLayerAdded) {
mapController.addLayer(Integer.MAX_VALUE, graphicsLayer, false);
isGraphicsLayerAdded = true;
}
String mgrs = mapController.pointToMgrs(pt, mapController.getSpatialReference());
jLabel_mgrs.setText(mgrs);
if (-1 != identifyPointGraphicUid) {
graphicsLayer.updateGraphic(identifyPointGraphicUid, pt);
} else {
identifyPointGraphicUid = graphicsLayer.addGraphic(new Graphic(pt, identifyPointSymbol));
}
}
}
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:26,代码来源:IdentifyResultsJPanel.java
示例3: displaySpotReport
import com.esri.core.map.Graphic; //导入依赖的package包/类
@Override
protected Integer displaySpotReport(double x, double y, final int wkid, Integer graphicId, Geomessage geomessage) {
try {
Geometry pt = new Point(x, y);
if (null != mapController.getSpatialReference() && wkid != mapController.getSpatialReference().getID()) {
pt = GeometryEngine.project(pt, SpatialReference.create(wkid), mapController.getSpatialReference());
}
if (null != graphicId) {
spotReportLayer.updateGraphic(graphicId, pt);
spotReportLayer.updateGraphic(graphicId, geomessage.getProperties());
} else {
Graphic graphic = new Graphic(pt, spotReportSymbol, geomessage.getProperties());
graphicId = spotReportLayer.addGraphic(graphic);
}
return graphicId;
} catch (NumberFormatException nfe) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "Could not parse spot report", nfe);
return null;
}
}
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:22,代码来源:AdvancedSymbolController.java
示例4: removeGeomessage
import com.esri.core.map.Graphic; //导入依赖的package包/类
private void removeGeomessage(Graphic graphic, boolean sendRemoveMessageForOwnMessages) {
final String geomessageId = (String) graphic.getAttributeValue(Geomessage.ID_FIELD_NAME);
final String geomessageType = (String) graphic.getAttributeValue(Geomessage.TYPE_FIELD_NAME);
String uniqueDesignation = (String) graphic.getAttributeValue("uniquedesignation");
if (sendRemoveMessageForOwnMessages && null != uniqueDesignation && uniqueDesignation.equals(messageController.getSenderUsername())) {
new Thread() {
public void run() {
try {
sendRemoveMessage(messageController, geomessageId, geomessageType);
} catch (Throwable t) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "Couldn't send REMOVE message", t);
}
}
}.start();
} else {
processRemoveGeomessage(geomessageId, geomessageType);
}
}
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:19,代码来源:AdvancedSymbolController.java
示例5: mouseClicked
import com.esri.core.map.Graphic; //导入依赖的package包/类
/**
* Computes the drive time zones on click of the mouse.
*/
@Override
public void mouseClicked(MouseEvent mapEvent) {
super.mouseClicked(mapEvent);
if (!enabled) {
return;
}
if (mapEvent.getButton() == MouseEvent.BUTTON3) {
// remove zones from previous computation
graphicsLayer.removeAll();
return;
}
// the click point is the starting point
Point startPoint = jMap.toMapPoint(mapEvent.getX(), mapEvent.getY());
Graphic startPointGraphic = new Graphic(startPoint, SYM_START_POINT);
graphicsLayer.addGraphic(startPointGraphic);
executeDriveTimes(startPointGraphic);
}
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:26,代码来源:DriveTimeExecutor.java
示例6: processResult
import com.esri.core.map.Graphic; //导入依赖的package包/类
/**
* Process result from geoprocessing execution.
*
* @param result output of geoprocessing execution.
*/
private void processResult(GPParameter[] result) {
for (GPParameter outputParameter : result) {
if (outputParameter instanceof GPFeatureRecordSetLayer) {
GPFeatureRecordSetLayer gpLayer = (GPFeatureRecordSetLayer) outputParameter;
int zone = 0;
// get all the graphics and add them to the graphics layer.
// there will be one graphic per zone.
for (Graphic graphic : gpLayer.getGraphics()) {
Graphic theGraphic = new Graphic(graphic.getGeometry(), zoneFillSymbols[zone++]);
// add to the graphics layer
graphicsLayer.addGraphic(theGraphic);
}
}
}
}
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:21,代码来源:DriveTimeExecutor.java
示例7: highlightGeometry
import com.esri.core.map.Graphic; //导入依赖的package包/类
private void highlightGeometry(Point point) {
if (point == null) {
return;
}
graphicsLayer.removeAll();
graphicsLayer.addGraphic(
new Graphic(point, new SimpleMarkerSymbol(Color.CYAN, 20, SimpleMarkerSymbol.Style.CIRCLE)));
// -----------------------------------------------------------------------------------------
// Zoom to the highlighted graphic
// -----------------------------------------------------------------------------------------
Geometry geometryForZoom = GeometryEngine.buffer(
point,
map.getSpatialReference(),
map.getFullExtent().getWidth() * 0.10,
map.getSpatialReference().getUnit());
map.zoomTo(geometryForZoom);
}
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:20,代码来源:DemoTheatreApp.java
示例8: processResult
import com.esri.core.map.Graphic; //导入依赖的package包/类
/**
* Process result from geoprocessing execution.
*
* @param result output of geoprocessing execution.
*/
private void processResult(GPParameter[] result) {
for (GPParameter outputParameter : result) {
if (outputParameter instanceof GPFeatureRecordSetLayer) {
GPFeatureRecordSetLayer gpLayer = (GPFeatureRecordSetLayer) outputParameter;
int zone = 0;
// get all the graphics and add them to the graphics layer.
// there will be one graphic per zone.
for (Graphic graphic : gpLayer.getGraphics()) {
SpatialReference fromSR = SpatialReference.create(4326);
Geometry g = graphic.getGeometry();
Geometry pg = GeometryEngine.project(g, fromSR, jMap.getSpatialReference());
Graphic theGraphic = new Graphic(pg, zoneFillSymbols[zone++]);
// add to the graphics layer
graphicsLayer.addGraphic(theGraphic);
}
}
}
}
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:24,代码来源:DemoTheatreApp.java
示例9: addGeoJsonFeatures
import com.esri.core.map.Graphic; //导入依赖的package包/类
/**
* Parse GeoJSON file and add the features to a graphics layer.
* @param graphicsLayer layer to which the features should be added.
*/
private void addGeoJsonFeatures(GraphicsLayer graphicsLayer) {
try {
// create an instance of the parser
GeoJsonParser geoJsonParser = new GeoJsonParser();
// provide the symbology for the features
CompositeSymbol symbol = new CompositeSymbol();
symbol.add(new SimpleFillSymbol(new Color(0, 255, 0, 70)));
symbol.add(new SimpleLineSymbol(Color.BLACK, 2));
geoJsonParser.setSymbol(symbol).setOutSpatialReference(map.getSpatialReference());
// parse geojson data
File geoJsonFile = new File(GEOJSON_DATA_FILE);
List<Feature> features = geoJsonParser.parseFeatures(geoJsonFile);
// add parsed features to a layer
for (Feature f : features) {
graphicsLayer.addGraphic(new Graphic(f.getGeometry(), f.getSymbol(), f.getAttributes()));
}
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:28,代码来源:GeoJsonApp.java
示例10: parseFeatures
import com.esri.core.map.Graphic; //导入依赖的package包/类
private List<Feature> parseFeatures(ArrayNode jsonFeatures) {
List<Feature> features = new LinkedList<Feature>();
for (JsonNode jsonFeature : jsonFeatures) {
String type = jsonFeature.path(FIELD_TYPE).getTextValue();
if (!FIELD_FEATURE.equals(type)) {
continue;
}
Geometry g = parseGeometry(jsonFeature.path(FIELD_GEOMETRY));
if (outSR != null && outSR.getID() != 4326) {
g = GeometryEngine.project(g, inSR, outSR);
}
Map<String, Object> attributes = parseProperties(jsonFeature.path(FIELD_PROPERTIES));
Feature f = new Graphic(g, symbol, attributes);
features.add(f);
}
return features;
}
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:18,代码来源:GeoJsonParser.java
示例11: addStaticGraphicsBulk
import com.esri.core.map.Graphic; //导入依赖的package包/类
private void addStaticGraphicsBulk(int numberOfGraphicsToAdd) {
double minx = mapExtent.getXMin();
double maxx = mapExtent.getXMax();
double miny= mapExtent.getYMin();
double maxy = mapExtent.getYMax();
Point[] points = new Point[numberOfGraphicsToAdd];
Graphic[] graphics = new Graphic[numberOfGraphicsToAdd];
int i = 0;
while (i < numberOfGraphicsToAdd) {
Point point = new Point((random.nextFloat()*(maxx-minx)) + minx, (random.nextFloat()*(maxy-miny)) + miny);
points[i] = point;
graphics[i] = new Graphic(point, null);
i++;
}
int[] ids = staticGraphicsLayer.addGraphics(graphics);
for (int j = 0; j < numberOfGraphicsToAdd; j++) {
latestStaticPoints.put(Integer.valueOf(ids[j]), points[j]);
}
}
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:23,代码来源:AddAndMoveGraphicsApp.java
示例12: addGraphics
import com.esri.core.map.Graphic; //导入依赖的package包/类
private void addGraphics(int numberOfGraphicsToAdd) {
double minx = mapExtent.getXMin();
double maxx = mapExtent.getXMax();
double miny= mapExtent.getYMin();
double maxy = mapExtent.getYMax();
int i = 0;
long startTime = System.currentTimeMillis();
while (i < numberOfGraphicsToAdd) {
Point point = new Point((random.nextFloat()*(maxx-minx)) + minx, (random.nextFloat()*(maxy-miny)) + miny);
int id;
if (addWithSymbol) {
id = graphicsLayer.addGraphic(new Graphic(point, symbol));
} else {
id = graphicsLayer.addGraphic(new Graphic(point, null));
}
latestDynamicPoints.put(Integer.valueOf(id), point);
i++;
}
JOptionPane.showMessageDialog(appWindow, "Total time: " + (System.currentTimeMillis() - startTime)/1000.0 + " seconds.");
}
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:23,代码来源:SymbolRendererApp.java
示例13: movePoints
import com.esri.core.map.Graphic; //导入依赖的package包/类
private void movePoints() {
// loop through them all
if (dynamicGraphicsLayer.getGraphicIDs()!=null) {
for (int id : dynamicGraphicsLayer.getGraphicIDs()) {
Point p1 = latestDynamicPoints.get(Integer.valueOf(id));
Point p2 = getPointForSmoothMove(p1.getX(), p1.getY(), id);
if (moveWithReplace) {
dynamicGraphicsLayer.removeGraphic(id);
int newId = dynamicGraphicsLayer.addGraphic(new Graphic(p2, null));
latestDynamicPoints.put(Integer.valueOf(newId), p2);
} else {
dynamicGraphicsLayer.updateGraphic(id, p2);
//dynamicGraphicsLayer.movePointGraphic(id, p2);
latestDynamicPoints.put(Integer.valueOf(id), p2);
}
// dynamicGraphicsLayer.movePointGraphic(id, getRandomPointFrom(p.getX(), p.getY(), spreadOfMove));
}
}
}
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:21,代码来源:MoveGraphicsApp.java
示例14: addSimpleMarkerGraphics
import com.esri.core.map.Graphic; //导入依赖的package包/类
/**
* Adds graphics symbolized with SimpleMarkerSymbols.
* @param graphicsLayer
*/
private void addSimpleMarkerGraphics(GraphicsLayer graphicsLayer, Envelope bounds) {
SimpleMarkerSymbol symbol = new SimpleMarkerSymbol(Color.RED, 16, Style.CIRCLE);
double xmin = bounds.getXMin();
double xmax = bounds.getXMax();
double xrand;
double ymin = bounds.getYMin();
double ymax = bounds.getYMax();
double yrand;
for (int i = 0; i < 1000; i++) {
xrand = xmin + (int) (Math.random() * ((xmax - xmin) + 1));
yrand = ymin + (int) (Math.random() * ((ymax - ymin) + 1));
Point point = new Point(xrand, yrand);
graphicsLayer.addGraphic(new Graphic(point, symbol));
}
}
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:21,代码来源:ClusterApp.java
示例15: GetDistAsString
import com.esri.core.map.Graphic; //导入依赖的package包/类
private String GetDistAsString(Graphic g, SpatialReference inputSr, String units)
{
com.esri.core.geometry.Geometry geo = g.getGeometry();
com.esri.core.geometry.Geometry curGeo;
if(!inputSr.equals(srBuffer))
{
curGeo = GeometryEngine.project(geo, inputSr, srBuffer);
}
else
{
curGeo=geo;
}
double tmpDist = GeometryEngine.distance(inGeometry, curGeo, srBuffer);
UnitConverter uc = new UnitConverter();
int inUnitWkid = uc.findWkid(srBuffer.getUnit().getName());
String cn = uc.findConnonicalName(units);
int outUnitWkid = uc.findWkid(cn);
double dist;
if(inUnitWkid!=outUnitWkid)
{
dist = uc.Convert(tmpDist, inUnitWkid, outUnitWkid);
}
else
{
dist=tmpDist;
}
DecimalFormat df = new DecimalFormat("#.00");
return df.format(dist);
}
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:32,代码来源:QueryReportProcessor.java
示例16: waypointAdded
import com.esri.core.map.Graphic; //导入依赖的package包/类
/**
* Called when a waypoint is added. This implementation adds a waypoint button.
* @param graphic the waypoint graphic, whose ID may or may not be populated.
* @param graphicUid the waypoint graphic's ID.
* @see RouteListener#waypointAdded(com.esri.core.map.Graphic, int)
*/
public void waypointAdded(Graphic graphic, int graphicUid) {
final JToggleButton button = new JToggleButton((String) graphic.getAttributeValue("name"));
waypointButtonToGraphicId.put(button, graphicUid);
graphicIdToWaypointButton.put(graphicUid, button);
Font font = new Font("Arial", Font.PLAIN, 18);
button.setFont(font);
button.setFocusable(false);
button.setSelected(false);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (button == selectedWaypointButton) {
//Unselect
buttonGroup_waypoints.remove(button);
button.setSelected(false);
buttonGroup_waypoints.add(button);
selectedWaypointButton = null;
routeController.setSelectedWaypoint(null);
} else {
selectedWaypointButton = button;
routeController.setSelectedWaypoint(waypointButtonToGraphicId.get(button));
}
}
});
button.setMaximumSize(new Dimension(Integer.MAX_VALUE, 60));
button.setMinimumSize(new Dimension(0, 60));
jPanel_waypointsList.add(button);
buttonGroup_waypoints.add(button);
}
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:38,代码来源:MainMenuJPanel.java
示例17: waypointSelected
import com.esri.core.map.Graphic; //导入依赖的package包/类
/**
* Called when a waypoint is selected. This implementation stores
* @param graphic
*/
public void waypointSelected(Graphic graphic) {
LocationController locationController = mapController.getLocationController();
if (locationController instanceof com.esri.vehiclecommander.controller.LocationController) {
((com.esri.vehiclecommander.controller.LocationController) locationController).setSelectedWaypoint(graphic);
}
}
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:11,代码来源:MainMenuJPanel.java
示例18: ChemLightJPanel
import com.esri.core.map.Graphic; //导入依赖的package包/类
/**
* Instantiates a ChemLightJPanel.
* @param chemLightController the ChemLightController used to send messages to
* update and remove chem lights.
* @param chemLight the chem light Graphic.
* @param chemLightSpatialReference the spatial reference for the chem light
* Graphic's point geometry.
*/
public ChemLightJPanel(
ChemLightController chemLightController,
Graphic chemLight,
SpatialReference chemLightSpatialReference) {
initComponents();
this.chemLightController = chemLightController;
this.chemLight = chemLight;
this.chemLightSR = chemLightSpatialReference;
}
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:19,代码来源:ChemLightJPanel.java
示例19: onLocationChanged
import com.esri.core.map.Graphic; //导入依赖的package包/类
public void onLocationChanged(Location location) {
if (null != location) {
final Point mapPoint = GeometryEngine.project(location.getLongitude(), location.getLatitude(), getSpatialReference());
new Thread() {
public void run() {
synchronized (lastLocationLock) {
lastLocation = mapPoint;
}
};
}.start();
if (isAutoPan()) {
map.panTo(mapPoint);
switch (getLocationController().getNavigationMode()) {
case NORTH_UP:
setRotation(0);
break;
case TRACK_UP:
setRotation(location.getHeading());
break;
case WAYPOINT_UP:
Graphic waypoint = ((LocationController) getLocationController()).getSelectedWaypoint();
if (null != waypoint) {
Point waypointLonLat = (Point) GeometryEngine.project(
waypoint.getGeometry(),
null == waypoint.getSpatialReference() ? getSpatialReference() : waypoint.getSpatialReference(),
Utilities.WGS84);
setRotation(Utilities.calculateBearingDegrees(location.getLongitude(), location.getLatitude(), waypointLonLat.getX(), waypointLonLat.getY()));
}
}
}
}
}
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:37,代码来源:MapController.java
示例20: identifyOneGraphic
import com.esri.core.map.Graphic; //导入依赖的package包/类
/**
* Identifies at most one Graphic in the specified layer within the specified tolerance.
* @param layerName the layer name.
* @param screenX the X value in pixels.
* @param screenY the Y value in pixels.
* @param tolerance the tolerance in pixels.
* @return the Graphic in the specified layer within the specified tolerance that is closest
* to the point specified by screenX and screenY, or null if no such Graphic exists.
*/
public Graphic identifyOneGraphic(String layerName, float screenX, float screenY, int tolerance) {
Layer layer = SPOT_REPORT_LAYER_NAME.equals(layerName) ? spotReportLayer : groupLayer.getLayer(layerName);
if (null != layer && layer instanceof GraphicsLayer) {
GraphicsLayer gl = (GraphicsLayer) layer;
int[] graphicIds = gl.getGraphicIDs(screenX, screenY, tolerance, 1);
if (0 < graphicIds.length) {
return gl.getGraphic(graphicIds[0]);
}
}
return null;
}
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:21,代码来源:AdvancedSymbolController.java
注:本文中的com.esri.core.map.Graphic类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论