Globe sun position


Purpose
This sample demonstrates how to control where the sun shines on the globe by creating a custom tool that enables mouse interaction to specify where on the globe the sun would shine most directly. Some of the sun's light characteristics, such as ambience and contrast, are specified in the code.
This sample application finds and applies an earth 3DD texture file to the globe bean, after which the globe bean is displayed with two buttons on the toolbar. One button is for navigation—panning and zooming the globe. (Using the left mouse button pans the globe; using the right mouse button zooms while dragging.)
The other toolbar button is the Set Sun Position custom tool. Clicking the Set Sun Position button causes the mouse cursor to change to a cross (if the cursor file is available) and behaves as a sun pointing tool. The tool causes the sun to shine directly at the location of the cursor while the mouse button is pressed and while the location of the mouse cursor is on the globe. The sun is directly overhead at that position. Half of the globe is illuminated, centered at that location. When the globe is rotated, the sun remains relative to that rotation. The sun moves when the globe is panned.

How to use

See How to use ArcGIS samples for help on running the sample.

  1. Start the sample application. The default globe texture map is loaded if no command line arguments are specified.
  2. Alternatively, pass in the location of a globe texture map as the first parameter.
  3. Wait for the globe texture file to load.
  4. Click the Set Sun Position button on the toolbar, click the globe, and move the cursor around the globe while pressing the mouse button.
  5. Click the navigation button (the first button on the toolbar).
  6. Pan the globe by dragging it while pressing the mouse button. Note that the other side of the globe is dark.
  7. Optionally, experiment with the code to change light characteristics, such as ambience and contrast values.
  8. Optionally, add other attributes, such as sun color.

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

globe/SunPosition.java Sets up the user interface (UI) and ensures licensing is correct.
globe/SunPositionTool.java Code necessary to create a custom tool.




Additional Requirements
  • Custom tool cursor file accessible at the root location of the sample.
  • 3DD texture file for the globe in the data directory for the sample.

Development licensing Deployment licensing
Engine Developer Kit Engine: 3D Analyst
ArcGIS for Desktop Basic: 3D Analyst