![]() ![]() Set the points spatial reference - WHERE the point is coming FROM Point.putCoords(agent.Longitude, agent.Latitude) * * agent */ public void createContainerElements(AgentInField agent) The point object is then projected onto projected coordinates on the * map control and added to graphic container. ![]() ** * Uses agent data to create a point object. ( "Exception in zoomFullExtentButton action performed : " ex) ![]() Assign map controls extent property to the full extent of all the layers If (event.getSource() = zoomFullExtentButton) If (event.getSource() = gpsTrackingCheck) ** * #actionPerformed(ActionEvent event) * event */ public void actionPerformed(ActionEvent event) GetContentPane().add(mainPanel, BorderLayout.CENTER) tBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) MainPanel.add(bottomPanel, BorderLayout.SOUTH) MainPanel.add(mapBean, BorderLayout.CENTER) Create map control add it to the center of the main panel. ZoomFullExtentButton.addActionListener( this) ZoomFullExtentButton = new JButton( "Zoom to Full Extent") GpsTrackingCheck.addActionListener( this) GpsTrackingCheck = new JCheckBox( "Enable GPS Tracking") tLayout( new BorderLayout()) ītLayout( new FlowLayout(FlowLayout.LEFT)) Timer = new Timer(1000, new TimerListener()) MapBean.refresh(esriViewDrawPhase.esriViewBackground, null, null) Loop through the array and display each agent location for ( int i = 0 i < agentArray.length - 1 i ) Populate an array with agent id's and locations ![]() GraphicsContainer = mapBean.getActiveView().getGraphicsContainer() Get the MapBean's graphics container and get the IGraphicsContainer interface // mapBean.refresh(esriViewDrawPhase.esriViewBackground, null, null) mapBean.refresh(esriViewDrawPhase.esriViewBackground, null, null) // Set up a global Geographic Coordinate System MapBean.addIMapControlEvents2Listener( new MapControlListener()) MapBean.addShapeFile(filePath, "continent") MapBean.addShapeFile(filePath, "world30") String filePath = devKitHome parator "java" parator "samples" įile.separator "data" parator "world" String devKitHome = System.getenv( "AGSDEVKITJAVA") ** * Initializes control and member variables. Use the other mouse buttons to click on an agent and change the symbology. String helpString = " Use the left mouse button to zoom in. IGraphicsContainer graphicsContainer = null IProjectedCoordinateSystem projectedCoordinateSystem = null IGeographicCoordinateSystem geographicCoordinateSystem = null ** * */ private static final long serialVersionUID = 1L */ public class TrackGPS extends JFrame implements ActionListener It also demonstrates setting a coordinatate systems and projecting data. ** * Description:This sample demonstrates adding elements to a Map's GraphicsContainer, and then moving them in response * to a timer. Import .IMapControlEvents2OnMouseDownEvent * * See the use restrictions at /DeveloperKit10.4/userestrictions.txt. * * You may freely redistribute and use this sample code, with or * without modification, provided you include the original copyright * notice and use restrictions. Arcgissamples\mapbean\TrackGPS.java /* Copyright 2015 ESRI * * All rights reserved under the copyright laws of the United States * and applicable international laws, treaties, and conventions. ![]()
0 Comments
Leave a Reply. |