Upload
others
View
20
Download
0
Embed Size (px)
Citation preview
Developers Guide to 3D Visualization Developers Guide to 3D Visualization in ArcGIS 9.2in ArcGIS 9.2
Nathan ShephardNathan ShephardNathan ShephardNathan ShephardTamrat BelaynehTamrat Belayneh
Developer Summit 2007Developer Summit 2007 11
ContentsContents
•• 3D Visualization (Mapping) defined3D Visualization (Mapping) defined•• Globe Data Display Management & ArchitectureGlobe Data Display Management & Architecture•• Globe Data Display Management & ArchitectureGlobe Data Display Management & Architecture•• Caching and optimizationCaching and optimization•• Data Preparation and Usage TipsData Preparation and Usage TipsData Preparation and Usage TipsData Preparation and Usage Tips•• Customization FrameworkCustomization Framework•• 3D Rendering3D Renderinggg•• Publishing 3D GlobesPublishing 3D Globes•• Developers Best Practice GuideDevelopers Best Practice Guidepp•• DemosDemos•• Question and AnswersQuestion and Answers
Developer Summit 2007Developer Summit 2007 22
What is 3D Mapping?What is 3D Mapping?
•• Viewing spatial data in 3D: raster, vector, elevationViewing spatial data in 3D: raster, vector, elevation•• Seamless transitions between global local and streetSeamless transitions between global local and street•• Seamless transitions between global, local and streetSeamless transitions between global, local and street--
level scale datalevel scale data•• Performing GIS analysis within a 3D contextPerforming GIS analysis within a 3D contextPerforming GIS analysis within a 3D contextPerforming GIS analysis within a 3D context•• 3D Mapping has applicability in fields such as:3D Mapping has applicability in fields such as:
–– GeologyGeologygygy–– MeteorologyMeteorology–– ClimatologyClimatology
H d lH d l–– HydrologyHydrology–– Utility ManagementUtility Management–– Disaster ManagementDisaster Management
Developer Summit 2007Developer Summit 2007 33
gg–– Real estate, etc... Real estate, etc...
3D GIS3D GIS
Surface Data in 3DSurface Data in 3D Image Data in 3DImage Data in 3D
Vector Data in 3DVector Data in 3D
Developer Summit 2007Developer Summit 2007 44
What can 3D Visualization do for you?What can 3D Visualization do for you?
•• Accurately represent realAccurately represent real--world GIS entities world GIS entities We live in a 3D world our data should display that wayWe live in a 3D world our data should display that way–– We live in a 3D world, our data should display that wayWe live in a 3D world, our data should display that way
•• Create realistic 3D models (e.g. cityscapes)Create realistic 3D models (e.g. cityscapes)–– Tourism, AdvertisingTourism, Advertising, g, g
•• Visualize ‘what if’ scenariosVisualize ‘what if’ scenarios–– Planned construction (buildings, roads, transmission lines, etc)Planned construction (buildings, roads, transmission lines, etc)–– Decision support systems (evacuation, mock attacks, etc)Decision support systems (evacuation, mock attacks, etc)
•• Gain insights into your data, including:Gain insights into your data, including:3D ti l l ti hi3D ti l l ti hi–– 3D spatial relationships3D spatial relationships
–– Sizes / ScalesSizes / Scales–– Visibility / Line of sightVisibility / Line of sight
Developer Summit 2007Developer Summit 2007 55
y gy g
3D Visualization Solutions from ESRI3D Visualization Solutions from ESRI
•• OutOut--ofof--thethe--box Desktop, Engine and Server solutionsbox Desktop, Engine and Server solutions•• Desktop:Desktop:pp
–– ArcGIS 3D Analyst (ArcGlobe and ArcScene)ArcGIS 3D Analyst (ArcGlobe and ArcScene)–– ArcGIS Explorer ArcGIS Explorer –– ArcReaderArcReader
•• ArcGIS Engine Solutions:ArcGIS Engine Solutions:Globe ControlGlobe Control–– Globe ControlGlobe Control
–– Scene ControlScene Control
•• ArcGIS Server Solution:ArcGIS Server Solution:–– Globe ServerGlobe Server–– Allows analysts to publish rich GIS web ServicesAllows analysts to publish rich GIS web Services
Developer Summit 2007Developer Summit 2007 66
–– No programming requiredNo programming required
3D Mapping Environments in ArcGIS 3D Mapping Environments in ArcGIS
ArcGlobeArcGlobe
ArcSceneArcScene
Developer Summit 2007Developer Summit 2007 77
ArcMapArcMap
3D Mapping Environments in ArcGIS3D Mapping Environments in ArcGIS
ArcReaderArcReader
ArcGIS ExplorerArcGIS Explorer
Developer Summit 2007Developer Summit 2007 88
ArcCatalogArcCatalog
3D Mapping Environments in ArcGIS3D Mapping Environments in ArcGIS
Extensions to ArcGIS applicationsExtensions to ArcGIS applications
Custom Application Built using ControlsCustom Application Built using Controls
Developer Summit 2007Developer Summit 2007 99
3D Mapping Environments in ArcGIS3D Mapping Environments in ArcGIS
Example: standExample: stand--alone alone 3D Visualization3D Visualization by TouchTable Inc.by TouchTable Inc.
Developer Summit 2007Developer Summit 2007 1010
Globe Data Management ArchitectureGlobe Data Management Architecture
•• All Globe based application share a fixed internal All Globe based application share a fixed internal Spatial ReferenceSpatial Reference -- the Cube Projectionthe Cube Projection-- that organizesthat organizesSpatial Reference Spatial Reference -- the Cube Projectionthe Cube Projection-- that organizes that organizes and optimizes display and optimizes display
Cube Cube Projection in Projection in
2D view2D view
Developer Summit 2007Developer Summit 2007 1111
Globe Data Management ArchitectureGlobe Data Management Architecture
•• Data is internally divided into Data is internally divided into tilestiles at different levels of at different levels of detail (detail (scalesscales))detail (detail (scalesscales))
Data area
Level 0 Level 1 Level 2
•• Results in a Results in a multimulti--resolutionresolution representation of the data representation of the data
•• Features as vectors have only one level of detailFeatures as vectors have only one level of detail
Developer Summit 2007Developer Summit 2007 1212
Globe Data Caching ArchitectureGlobe Data Caching Architecture
•• To improve display performance, all Globe applications To improve display performance, all Globe applications keep a cache of tiles for eachkeep a cache of tiles for each layerlayerkeep a cache of tiles for each keep a cache of tiles for each layerlayer–– ArcGlobe, ArcGIS Explorer, ArcReader, GlobeControl appsArcGlobe, ArcGIS Explorer, ArcReader, GlobeControl apps
•• Tiles are stored in the Tiles are stored in the memorymemory cachecache for immediate usefor immediate useyy•• Tiles are written to the Tiles are written to the diskdisk cachecache for later usefor later use•• Tiles are swapped between the memory cache and the Tiles are swapped between the memory cache and the
disk cache based on resources and the current viewdisk cache based on resources and the current view•• The architecture uses The architecture uses two threadstwo threads::
–– One for rendering and navigationOne for rendering and navigation–– One for tile creation, writing and fetchingOne for tile creation, writing and fetching
Developer Summit 2007Developer Summit 2007 1313
Globe Data Caching ArchitectureGlobe Data Caching Architecture
Vi li ti
Til
Memory cacheManager Visualization
TileGeneration
Disk cache
D Data sources
Disk cache
Dataset File
SDEdatabase
Remote
ServerData sources
Developer Summit 2007Developer Summit 2007 1414
data
Globe Data Caching ArchitectureGlobe Data Caching Architecture
•• The memory cache is configured by data typeThe memory cache is configured by data typeMemory cacheMemory cache
•• The application will define a default size and The application will define a default size and configuration for the memory cache, but can be configuration for the memory cache, but can be overridden for large or specialized 3D viewsoverridden for large or specialized 3D viewsoverridden for large or specialized 3D viewsoverridden for large or specialized 3D views
•• Total memory usage should not exceed the Total memory usage should not exceed the physical memory (RAM)physical memory (RAM)y y ( )y y ( )
Tools > Options
Developer Summit 2007Developer Summit 2007 1515
IGlobeAdvancedProperties2.GetTileMemory(type, limit, current);.SetTileMemory(type, limit);
Globe Data Caching ArchitectureGlobe Data Caching Architecture
•• Visualization tiles stored on disk for fast retrievalVisualization tiles stored on disk for fast retrievalDisk cacheDisk cache
•• Each layer cache is Each layer cache is preservedpreserved between sessions between sessions only if the layer is saved in a document or layer fileonly if the layer is saved in a document or layer file
•• The layer cache is The layer cache is invalidatedinvalidated if any display if any display properties change (for example, symbology)properties change (for example, symbology)
•• There are two methods of generating the cache:There are two methods of generating the cache:
–– OnOn--demanddemand: tiles created as needed (default): tiles created as needed (default)
–– ExplicitExplicit: all areas: all areas
•• PartialPartial: only specified levels of detail (scales): only specified levels of detail (scales)
Developer Summit 2007Developer Summit 2007 1616
y p ( )y p ( )
•• FullFull: all levels of detail (scales): all levels of detail (scales)
Globe Data Caching ArchitectureGlobe Data Caching Architecture
•• Indicated by Indicated by spinning globespinning globe in ArcGlobe’s status barin ArcGlobe’s status barOnOn--demand caching demand caching (default)(default)
•• It doesn’t interrupt navigation (multiIt doesn’t interrupt navigation (multi--threaded)threaded)
IGlobeStatInfo.Statistic(esriTileRequestQueue)
•• The data source location, format, and projection The data source location, format, and projection impacts the caching performanceimpacts the caching performance (see Tips)(see Tips)
•• Build a cache for an Build a cache for an area of interestarea of interest by using a by using a cameracamera animation to preanimation to pre--visit the areavisit the area
•• Disable disk cachingDisable disk caching for layers with data that is for layers with data that is constantly changing / updatingconstantly changing / updating
Developer Summit 2007Developer Summit 2007 1717
IGlobeLayerProperties2.UseCache = False;
Globe Data Caching ArchitectureGlobe Data Caching Architecture
•• Creates tiles for the layer for specificCreates tiles for the layer for specific levels of detaillevels of detailM t k hil t l t ( i t h d )M t k hil t l t ( i t h d )
Explicit cachingExplicit caching
•• May take a while to complete (minutes, hours, days)May take a while to complete (minutes, hours, days)
•• Avoids the performance cost of onAvoids the performance cost of on--demand cachingdemand caching
Developer Summit 2007Developer Summit 2007 1818
IGlobeDisplayLayers.GenerateTiles(ILayer, FromLOD, ToLOD)
Data preparation tipsData preparation tips
•• Raster data:Raster data:
( )( )
p p pp p p
––Build Build pyramidspyramids when supported (UI prompt)when supported (UI prompt)
––If the data extent is between 45If the data extent is between 45°°N and 45N and 45°°S, S, project toproject to Geographic Coordinate SystemGeographic Coordinate System (GCS)(GCS)project to project to Geographic Coordinate SystemGeographic Coordinate System (GCS)(GCS)
––Otherwise, project to Otherwise, project to World CubeWorld Cube PCS PCS
––Store rasters in Store rasters in ArcSDEArcSDE –– it improves caching it improves caching performance and memory usageperformance and memory usage
F t ithF t ith l il i h f th f t––Formats with Formats with less compressionless compression cache fastercache faster
––Create a Create a Raster CatalogRaster Catalog when displaying many when displaying many images that make a mosaic (eg: aerial photos)images that make a mosaic (eg: aerial photos)
Developer Summit 2007Developer Summit 2007 1919
images that make a mosaic (eg: aerial photos)images that make a mosaic (eg: aerial photos)
Data preparation tipsData preparation tips
•• Feature data:Feature data:
p p pp p p
––For data that needs to be seen through a wide For data that needs to be seen through a wide range of scales, use range of scales, use multiple representationsmultiple representations•• Where possible, create separate feature classesWhere possible, create separate feature classes
•• Assign each representation a different visibility rangeAssign each representation a different visibility range
––SimplifySimplify geometry details that are not importantgeometry details that are not important•• Remove building interiors, if not neededRemove building interiors, if not needed
•• Reduce the vertex count for polylines / polygonsReduce the vertex count for polylines / polygons
––Downscale or disable multipatch Downscale or disable multipatch texturestextures
Developer Summit 2007Developer Summit 2007 2020
•• This can be done as a layer property or in the dataThis can be done as a layer property or in the data
Layer Property setting tipsLayer Property setting tips
If you don’t need the full image resolution theIf you don’t need the full image resolution the cell sizecell size can becan be
•• Raster dataRaster data–– If you don’t need the full image resolution, the If you don’t need the full image resolution, the cell sizecell size can be can be
increased to reduce cache sizeincreased to reduce cache size–– CompressionCompression can help manage cache size and performancecan help manage cache size and performance
•• A JPEG cache type will create a smaller cache sizeA JPEG cache type will create a smaller cache size•• A JPEG cache type will create a smaller cache sizeA JPEG cache type will create a smaller cache size•• A DXT cache type will render faster (no uncompression step)A DXT cache type will render faster (no uncompression step)
IGlobeLayerProperties2.CacheCompressionType
Developer Summit 2007Developer Summit 2007 2121
IGlobeLayerProperties2.MinimumCellSize
Layer Property setting tipsLayer Property setting tips
•• Feature data:Feature data:
Layer Property setting tipsLayer Property setting tips
––Features can be displayed as Features can be displayed as vectorvector or or rasterizedrasterized•• Use vectors for 3D geometries (pipes, buildings, trees) Use vectors for 3D geometries (pipes, buildings, trees)
U t f d d f t ( d t i )U t f d d f t ( d t i )•• Use rasters for draped features (roads, countries)Use rasters for draped features (roads, countries)IGlobeLayerProperties2.IsDynamicallyRasterized
––Where possible, display features as Where possible, display features as rasterizedrasterized•• It will perform faster and drape on the surface betterIt will perform faster and drape on the surface better
––Use aUse a visibility distance rangesvisibility distance ranges A lotA lot––Use a Use a visibility distance rangesvisibility distance ranges. A lot.. A lot.IGlobeLayerProperties2.MinimumDistance.MaximumDistance
Developer Summit 2007Developer Summit 2007 2222
Layer Property setting tipsLayer Property setting tips
•• Feature data (rasterized):Feature data (rasterized):
Layer Property setting tipsLayer Property setting tips
( )( )––Reduce the Reduce the level of detaillevel of detail as much as possibleas much as possible
•• Each higher resolution LOD creates four times the Each higher resolution LOD creates four times the number of tiles as the previous LODnumber of tiles as the previous LOD
––If many rasterized feature layers are used in the If many rasterized feature layers are used in the same area use asame area use a Group Layer CacheGroup Layer Cachesame area, use a same area, use a Group Layer CacheGroup Layer Cache
––Generate a full or partial Generate a full or partial layer cachelayer cacheIGlobeDisplayLayers.GenerateTilesG obe sp ay aye s.Ge e ate es(ILayer, FromLOD, ToLOD)
Developer Summit 2007Developer Summit 2007 2323
Layer Property setting tipsLayer Property setting tips
•• Feature data as vectorFeature data as vector
Layer Property setting tipsLayer Property setting tips
–– Set the Set the scalescale (level of detail) carefully(level of detail) carefully•• A default is calculated based on the data (extent, etc)A default is calculated based on the data (extent, etc)•• Too many features (vertices) in one tile will result in aToo many features (vertices) in one tile will result in a featurefeature•• Too many features (vertices) in one tile will result in a Too many features (vertices) in one tile will result in a feature feature
overflowoverflow warningwarning•• Larger tiles mean smaller cache and better performanceLarger tiles mean smaller cache and better performance•• Smaller tiles mean better perSmaller tiles mean better per tile visibility switchingtile visibility switching•• Smaller tiles mean better perSmaller tiles mean better per--tile visibility switchingtile visibility switching
–– Hide the baseHide the base of extruded polygonsof extruded polygonsIGlobeHeightProperties2.BottomlessExtrusions
–– Generate a full Generate a full layer cachelayer cache•• Vector layers only have a single level of detail and therefore make Vector layers only have a single level of detail and therefore make
good candidates for a full cachegood candidates for a full cache
Developer Summit 2007Developer Summit 2007 2424
Setting the Scale for vector dataSetting the Scale for vector data
Each step down in the scale requires 4 times the number qof tiles as the previous one
The green range shows the recommended settings based on a preliminary investigation of the data
The default or current valueIGlobeLayerProperties2
IGlobeLayerProperties2.EstimateFeatureLODRange
Developer Summit 2007Developer Summit 2007 2525
IGlobeLayerProperties2.MaxFeatureLevelOfDetail
Group Layer CachesGroup Layer Caches
•• ConsolidatesConsolidates draped imagesdraped images andand rasterized featuresrasterized features in a in a group layer into a single rendering passgroup layer into a single rendering pass
p yp y
group layer into a single rendering passgroup layer into a single rendering pass
•• The group layer will get itsThe group layer will get its own cacheown cache of tilesof tiles
IGlobeHelperPub.SetGroupLayerCache ( parameters )
The group layer will get its The group layer will get its own cacheown cache of tilesof tiles
–– Optionally, child layers can also continue to keep their own cacheOptionally, child layers can also continue to keep their own cache
•• Notes on consolidated group layers:Notes on consolidated group layers:Notes on consolidated group layers:Notes on consolidated group layers:
–– The group layer cache is invalidated easilyThe group layer cache is invalidated easily
–– Coarser images will be magnified to blend with the others. Use Coarser images will be magnified to blend with the others. Use g gg gthe the SmoothSmooth texturing modetexturing mode for themfor them
–– The The visibilityvisibility distancesdistances of the child layers is approximatedof the child layers is approximated
Developer Summit 2007Developer Summit 2007 2626
–– Elevation / Vector layers in the group are not affectedElevation / Vector layers in the group are not affected
Group Layer CachesGroup Layer Caches
•• Example 1: Example 1: BackgroundBackground--based group layerbased group layerLayers:Layers: StatesStates CountiesCounties RiversRivers TownsTowns–– Layers: Layers: StatesStates, , CountiesCounties, , RiversRivers, , TownsTowns
–– No child caches No child caches –– 1 cache, 1 rendering pass1 cache, 1 rendering pass–– With child caches With child caches –– 5 caches, 1 rendering pass5 caches, 1 rendering pass
•• Example 2: Example 2: RegionRegion--based group layerbased group layer–– Layers: Flight Paths, Layers: Flight Paths, Aerial PhotoAerial Photo, , StreetsStreets, 3D buildings, 3D buildings–– No child caches No child caches –– 3 caches, 3 rendering passes3 caches, 3 rendering passes–– With child caches With child caches –– 5 caches, 3 rendering passes5 caches, 3 rendering passes
LessonLessonLessonLesson-- Group layer caches can improve performance, Group layer caches can improve performance,
especially for mature fully rasterized group layersespecially for mature fully rasterized group layers
Developer Summit 2007Developer Summit 2007 2727
especially for mature, fully rasterized group layers.especially for mature, fully rasterized group layers.
Customization FrameworkCustomization Framework
•• All Globe based application share ArcGIS 9x customization All Globe based application share ArcGIS 9x customization f kf k
Customization FrameworkCustomization Framework
framework:framework:
–– COMCOM components (ArcObjects), also accessible from components (ArcObjects), also accessible from .NET.NETand and JavaJava APIsAPIs
•• esriGlobeCore, esriGlobeCoreUI, esriArcGlobeesriGlobeCore, esriGlobeCoreUI, esriArcGlobe
–– As part of As part of 3D Analyst3D Analyst, shares the Multipatch (3D textured , shares the Multipatch (3D textured features), 3D Symbols, Video Exporters and Animation features), 3D Symbols, Video Exporters and Animation objectsobjects
–– Embedded Visual Basic for Applications (Embedded Visual Basic for Applications (VBAVBA))pp (pp ( ))
•• Globe ActiveX Globe ActiveX ControlControl•• CrossCross--platform developmentplatform development
Developer Summit 2007Developer Summit 2007 2828
–– Available on Windows, Linux, and SolarisAvailable on Windows, Linux, and Solaris
Typical Globe Based Application LayoutTypical Globe Based Application Layout
Application
TOCLayer1
GlobeViewerBaseOpenGL calls
Layer2. . . Globe GlobeDisplay
3DPropertiesFile
DatasetsDatasets
Developer Summit 2007Developer Summit 2007 2929
SDEGDB Web (remote)
Datasets
Globe Object ModelGlobe Object Model
Application(ArcGlobe)
Application(ArcEngine)
GMxDocumentGlobeControl
GlobeDisplayIGlobeDisplay
AnimationTrackesri3DAnalyst.IAnimationTrack
0..*
1..*
GlobeKeyframeesri3DAnalyst.IKeyframe
Globeesri3DAnalyst.IScene
IGlobe
GlobeDisplay
GlobeViewer
3DViewer
1..*
1..*
IGlobeDisplayLayers
IGlobeViewer
I3DViewer
IGlobeDisplayRendering
LayeresriCarto.ILayer
0..*
3DViewer
GlobeCamera
I3DViewer
ICameraIGlobeCamera
GlobeLayerPropertiesIGlobeLayerProperties
Developer Summit 2007Developer Summit 2007 3030
GlobeHeightPropertiesIGlobeHeightPropertiesGlobeAdvancedOptionsIGlobeAdvancedOptions
3D R d i3D R d i
•• OutOut--ofof--thethe--box functionalitybox functionality
3D Rendering3D Rendering
•• Animation FrameworkAnimation Framework•• Globe 3D GraphicsGlobe 3D Graphics
––PointPoint––LineLine––PolygonPolygon––TextText––3D MarkerSymbols3D MarkerSymbols
Developer Summit 2007Developer Summit 2007 3131
3D Rendering APIs3D Rendering APIs
•• GlobeGraphics APIGlobeGraphics APIGlobeGraphics APIGlobeGraphics API–– GraphicsLayerGraphicsLayer–– GraphicsElementGraphicsElement
•• Globe APIGlobe API–– 3D Symbols3D Symbols
C di t i tilitC di t i tilit–– Coordinate conversion utilityCoordinate conversion utility–– CustomGlobeLayerCustomGlobeLayer
•• OpenGL APIOpenGL APIOpenGL APIOpenGL API–– Globe framework provides mechanism to plugGlobe framework provides mechanism to plug--in OpenGL in OpenGL
callscalls
Developer Summit 2007Developer Summit 2007 3232
3D Rendering 3D Rendering -- Using GlobeGraphicsUsing GlobeGraphics••OutOut--ofof--thethe--box functionality to create 3D Scenesbox functionality to create 3D Scenes
Developer Summit 2007Developer Summit 2007 3333
3D Rendering 3D Rendering –– GlobeGraphics ToolbarGlobeGraphics Toolbar
Developer Summit 2007Developer Summit 2007 3434
GlobeGraphicsElementGlobeGraphicsElement
•• Element typesElement types–– PointElementPointElementPointElementPointElement–– LineElementLineElement–– PolygonElementPolygonElement–– MultiPatchElementMultiPatchElement–– TextElement3DTextElement3D
•• Creating ElementCreating Element•• Creating ElementCreating Element–– Setting Element Geometry and PropertiesSetting Element Geometry and Properties–– Symbolizing ElementSymbolizing Element–– Adding Element to the Graphics Layer (Container)Adding Element to the Graphics Layer (Container)
Developer Summit 2007Developer Summit 2007 3535
Globe Graphics Object ModelGlobe Graphics Object Model
0 ..*
1..*
Developer Summit 2007Developer Summit 2007 3636
GlobeGraphicsLayer API usage (C++)GlobeGraphicsLayer API usage (C++)p y g ( )p y g ( )
//Create a new graphics layer//Create a new graphics layerm_ipGlobeGraphicsLayer.CreateInstance(CLSID_GlobeGraphicsLayer);ILayer* (m_ipGlobeGraphicsLayer)->put_Name(L"MyGraphicsLayer");
//Add the new graphic layer to the globeIGlobe* ipGlobe;pm_ipGlobeDisplay->get_Globe(&ipGlobe);IScene* (ipGlobe)->AddLayer(ILayerPtr(m_ipGlobeGraphicsLayer), VARIANT_TRUE);
//Activate the new graphics layerIScene* (ipGlobe)->ActiveGraphicsLayer(ILayerPtr(m_ipGlobeGraphicsLayer));
Developer Summit 2007Developer Summit 2007 3737
//C t th l t’ t
GlobeGraphics Element with 3D Symbols GlobeGraphics Element with 3D Symbols (C++)(C++)//Create the element’s geometryIPoint* ipPoint(CLSID_Point);IZAware* (ipPoint)->put_ZAware(VARIANT_TRUE);ipPoint->PutCoords(position.longitude, position.latitude);ipPoint->put_Z(position.altitude);
//Create the element’s color (red)IRgbColor* ipColor(CLSID_RgbColor);ipColor->put_Red(255L);ipColor->put Green(0L);p p _ipColor->put_Blue(0L);
//Set the element’s symbolIMarkerSymbol* ipMarkerSymbol(CLSID_SimpleMarker3DSymbol);_ISimpleMarker3DSymbol* (ipMarkerSymbol)->put_Style(esriS3DMSSphere);ISimpleMarker3DSymbol* (ipMarkerSymbol)->put_ResolutionQuality(1.0);ipMarkerSymbol->put_Size(700.0);ipMarkerSymbol->put_Color(IColorPtr(ipColor));
//Create the new marker symbol elementIElement* ipTrackElement(CLSID_MarkerElement);IMarkerElement* (ipTrackElement)->put_Symbol(ipMarkerSymbol);ipTrackElement->put_Geometry(IGeometryPtr(ipPoint));
Developer Summit 2007Developer Summit 2007 3838
//Add the graphic element to the graphics layerIGrphicsContainer* (m_ipGlobeGraphicsLayer)->AddElement(ipTrackElement);
DemoDemo
•• Creating and Using Graphics Creating and Using Graphics
•• Designing a Globe ApplicationDesigning a Globe ApplicationDesigning a Globe ApplicationDesigning a Globe Application
Developer Summit 2007Developer Summit 2007 3939
3D Rendering3D Rendering -- Using Globe APIUsing Globe API3D Rendering 3D Rendering Using Globe APIUsing Globe API
•• Directly draw geometry using selected symbol Directly draw geometry using selected symbol y g y g yy g y g ythrough IDisplay, IDraw, IGlobeDisplay3through IDisplay, IDraw, IGlobeDisplay3
•• Control the rendering as neededControl the rendering as neededC t ki i bj tC t ki i bj t––Camera tracking moving objectCamera tracking moving object
•• Use custom layers to render Use custom layers to render ––Setting Element Geometry and PropertiesSetting Element Geometry and Properties––Setting Element Geometry and PropertiesSetting Element Geometry and Properties––Symbolizing ElementSymbolizing Element––Adding Element to the Graphics Layer (Container)Adding Element to the Graphics Layer (Container)g p y ( )g p y ( )
Developer Summit 2007Developer Summit 2007 4040
Custom Rendering using Custom LayersCustom Rendering using Custom LayersCustom Rendering using Custom LayersCustom Rendering using Custom Layersg g yg g yg g yg g y
•• Significantly improved at ArcGIS 9.2.Significantly improved at ArcGIS 9.2.N d t li t t Gl b Di l E tN d t li t t Gl b Di l E t•• No need to listen to GlobeDisplayEventsNo need to listen to GlobeDisplayEvents
•• OpenGL can be directly called inside the method OpenGL can be directly called inside the method DrawImmediate()DrawImmediate()DrawImmediate()DrawImmediate()
•• Provides HitProvides Hit--Test mechanism for picking and Test mechanism for picking and selection in 3Dselection in 3D
•• Provides mechanism to get around floating point Provides mechanism to get around floating point rendering precision in OpenGLrendering precision in OpenGL
Developer Summit 2007Developer Summit 2007 4141
Custom Rendering using Custom LayersCustom Rendering using Custom LayersCustom Rendering using Custom LayersCustom Rendering using Custom Layersg g yg g yg g yg g y
•• Your custom layer needs to implement the following Your custom layer needs to implement the following four interfaces at the minimum:four interfaces at the minimum:four interfaces at the minimum: four interfaces at the minimum: –– ESRI.ArcGIS.GlobeCore.ICustomGlobeLayer, ESRI.ArcGIS.GlobeCore.ICustomGlobeLayer, –– ESRI.ArcGIS.Carto.ILayerESRI.ArcGIS.Carto.ILayer, ,
ESRI ArcGIS Geodatabase IGeoDatasetESRI ArcGIS Geodatabase IGeoDataset–– ESRI.ArcGIS.Geodatabase.IGeoDataset,ESRI.ArcGIS.Geodatabase.IGeoDataset,–– ESRI.ArcGIS.Carto.ILayerExtensions ESRI.ArcGIS.Carto.ILayerExtensions
O ti ll i l t i t if lO ti ll i l t i t if l•• Optionally implement persistency if your layers Optionally implement persistency if your layers need to be saved (recommended)need to be saved (recommended)
•• Optionally implement Optionally implement ILayerEffectsILayerEffects and create a and create a Feature3DpropertiesFeature3Dproperties extension to support layer extension to support layer effectseffects
Developer Summit 2007Developer Summit 2007 4242
effectseffects
Custom Rendering using Custom LayersCustom Rendering using Custom LayersCustom Rendering using Custom LayersCustom Rendering using Custom Layers
•• The supported draw types are (at version 9.2)The supported draw types are (at version 9.2)esriGlobeCustomDrawRasterize,esriGlobeCustomDrawRasterize,
g g yg g yg g yg g y
esriGlobeCustomDrawRasterize, esriGlobeCustomDrawRasterize, esriGlobeCustomDrawByTile,esriGlobeCustomDrawByTile,esriGlobeCustomDrawOpenGL,esriGlobeCustomDrawOpenGL,esriGlobeCustomDrawVector,esriGlobeCustomDrawVector,esriGlobeCustomDrawOpenGLAndRasterize.esriGlobeCustomDrawOpenGLAndRasterize.
T d i O GL th d t t b t tT d i O GL th d t t b t t•• To draw in OpenGL the draw type must be set to To draw in OpenGL the draw type must be set to esriGlobeCustomDrawOpenGL or esriGlobeCustomDrawOpenGL or esriGlobeCustomDrawOpenGLAndRasterizeesriGlobeCustomDrawOpenGLAndRasterizeesriGlobeCustomDrawOpenGLAndRasterizeesriGlobeCustomDrawOpenGLAndRasterize
•• Methods of IDisplay and IDraw can be mixed with Methods of IDisplay and IDraw can be mixed with OpenGL calls when the DirectOpenGLDraw flag of the OpenGL calls when the DirectOpenGLDraw flag of the IGl b Di l 3 i t t TIGl b Di l 3 i t t T
Developer Summit 2007Developer Summit 2007 4343
IGlobeDisplay3 is set to TrueIGlobeDisplay3 is set to True
Custom Rendering Using OpenGLCustom Rendering Using OpenGL
All Globe based application allow direct call to OpenGL APIAll Globe based application allow direct call to OpenGL API
Custom Rendering Using OpenGLCustom Rendering Using OpenGL
When to useWhen to use–– In Commands and ToolsIn Commands and Tools–– Inside the BeforeDraw() and AfterDraw() events ofInside the BeforeDraw() and AfterDraw() events ofInside the BeforeDraw() and AfterDraw() events of Inside the BeforeDraw() and AfterDraw() events of
IGlobeDisplayEventsIGlobeDisplayEventsHow to useHow to use
S t th Di l i t Di t O GL dS t th Di l i t Di t O GL d–– Set the Display into Direct OpenGL modeSet the Display into Direct OpenGL mode–– Set the symbol to the DisplaySet the symbol to the Display–– Call the method to draw the geometryCall the method to draw the geometry–– Optionally call the OpenGL functionsOptionally call the OpenGL functions–– Restore the Display modeRestore the Display mode
Developer Summit 2007Developer Summit 2007 4444
Why use OpenGLWhy use OpenGLWhy use OpenGLWhy use OpenGL•• Add functionality not available on the UIAdd functionality not available on the UI
Interactively displace/rotate graphic objectInteractively displace/rotate graphic object–– Interactively displace/rotate graphic objectInteractively displace/rotate graphic object
•• Render custom data sourcesRender custom data sources–– Web Services, realWeb Services, real--time feed, simulationtime feed, simulation,, ,,
•• Add special effect to the globe displayAdd special effect to the globe display–– Simulate fire, smoke, rain, flood, wave, etcSimulate fire, smoke, rain, flood, wave, etc
Developer Summit 2007Developer Summit 2007 4545
Custom Rendering: how does it work?Custom Rendering: how does it work?Custom Rendering: how does it work?Custom Rendering: how does it work?gggg
GlobeDisplay::Redraw
2 BeforeDraw 5 AfterDraw C t O GL
1. BeforeDrawevent
4. AfterDrawevent3. Draw the globe
2. BeforeDraw callback
5. AfterDraw callback
Custom OpenGLRendering Object
Developer Summit 2007Developer Summit 2007 4646
Custom OpenGL Rendering (in C#)Custom OpenGL Rendering (in C#)g ( )g ( )public class MyCoolCommand : ESRI.ArcGIS.Utility.BaseClasses.BaseCommand
{private ESRI.ArcGIS.Controls.GlobeHookHelper m_globeHookHelper = null;private IGlobeDisplay m_globeDisplay = null;private IGlobeDisplayEvents Event m globeDisplayEvents = null;private IGlobeDisplayEvents_Event m_globeDisplayEvents null;
}
public override void OnCreate(object hook){
//...m_globeHookHelper = new GlobeHookHelperClass(); m_globeHookHelper.Hook = hook; m_globeDisplay = m_globeHookHelper.GlobeDisplay;m_globeDisplayEvent = this.m_globeDisplay as IGlobeDisplayEvents_Event;m_globeDisplayEvent.AfterDraw += IGlobeDisplayEvents_AfterDrawEventHandler(m_globeDisplayEvent_AfterDraw);
}
public void AfterDraw(ISceneViewer sceneViewer){
//Use OpenGL API here
Developer Summit 2007Developer Summit 2007 4747
//Use OpenGL API here}
Server Based 3D Mapping Server Based 3D Mapping
•• All geographic data is hosted on the serverAll geographic data is hosted on the server
•• High performance globe services deliver data for High performance globe services deliver data for viewing by 3D client applicationsviewing by 3D client applicationse g by 3 c e t app cat o se g by 3 c e t app cat o s–– ArcGIS Explorer, ArcReader, ArcGlobe, ArcEngineArcGIS Explorer, ArcReader, ArcGlobe, ArcEngine
•• Allows organizations to centrally manage their Allows organizations to centrally manage their geographic datageographic data
•• Allows end users and analysts to work with data in Allows end users and analysts to work with data in a 3D mapping environmenta 3D mapping environment
Developer Summit 2007Developer Summit 2007 4848
a 3D mapping environmenta 3D mapping environment
ArcGIS Server 9.2 : Globe ServicesArcGIS Server 9.2 : Globe Services
•• Globe Services are new functionality of ArcGIS Globe Services are new functionality of ArcGIS Server at 9.2Server at 9.2
•• Globe Services are available both in ArcGIS Server Globe Services are available both in ArcGIS Server for Microsoft .Net and ArcGIS Server for Java for Microsoft .Net and ArcGIS Server for Java
d td tproducts.products.•• To be able to publish Globe Services you’ll need to To be able to publish Globe Services you’ll need to
have ArcGIS Server with 3dserver licensehave ArcGIS Server with 3dserver licensehave ArcGIS Server with 3dserver license.have ArcGIS Server with 3dserver license.•• You’ll also need to have ArcGIS Desktop with 3D You’ll also need to have ArcGIS Desktop with 3D
Analyst license to prepare the publishing Documents.Analyst license to prepare the publishing Documents.y p p p gy p p p g
Developer Summit 2007Developer Summit 2007 4949
What is a Globe Service ?What is a Globe Service ?
•• Ability to publish your 3D GIS data to the WebAbility to publish your 3D GIS data to the Web•• Efficient streaming of globe visualization pages, Efficient streaming of globe visualization pages, g g gg g g
animation and ability to perform spatial queries on 3D animation and ability to perform spatial queries on 3D data. data.
•• Provides a means for generating, managing and Provides a means for generating, managing and serving optimized globe data. serving optimized globe data.
•• Supports both just in time (onSupports both just in time (on demand) and predemand) and pre•• Supports both just in time (onSupports both just in time (on--demand) and predemand) and pre--cached data serving models. cached data serving models.
Developer Summit 2007Developer Summit 2007 5050
What is a Globe Service ? Cont’dWhat is a Globe Service ? Cont’d
•• All ArcGlobe supported data types can be served.All ArcGlobe supported data types can be served.•• Supports Identify, Search, and Find features Supports Identify, Search, and Find features •• Supports Local area (LAN) and Web based accessSupports Local area (LAN) and Web based access•• A Globe Server is equipped to build a data cache, A Globe Server is equipped to build a data cache,
populate the cache on demand, or partially update populate the cache on demand, or partially update the cache on request.the cache on request.
Developer Summit 2007Developer Summit 2007 5151
Layer Types supported as a Globe ServiceLayer Types supported as a Globe ServiceLayer Types supported as a Globe ServiceLayer Types supported as a Globe Service
•• ElevationElevation•• ImageryImageryImageryImagery•• Rasterized 2D VectorsRasterized 2D Vectors•• Rasterized 2D TextRasterized 2D Textaste ed e taste ed e t•• 3D Vectors3D Vectors•• 3D Graphics and Text (bill boarded)3D Graphics and Text (bill boarded)p ( )p ( )
Developer Summit 2007Developer Summit 2007 5252
DemoDemo
Custom ApplicationsCustom ApplicationsConsuming Web ServicesConsuming Web ServicesConsuming Web ServicesConsuming Web ServicesEmbeddable ApplicationsEmbeddable Applications
Developer Summit 2007Developer Summit 2007 5353
Embeddable ArchitectureEmbeddable ArchitectureEmbeddable ArchitectureEmbeddable Architecture
Developer Summit 2007Developer Summit 2007 5454
Best Practices GuideBest Practices Guide
•• Calls to Locate() will result in additional calls to Calls to Locate() will result in additional calls to
Best Practices GuideBest Practices Guide
your AfterDraw() routine. This means that your your AfterDraw() routine. This means that your AfterDraw() could be called from an unexpected AfterDraw() could be called from an unexpected location. The easiest way to prevent against this is location. The easiest way to prevent against this is y p gy p gto make sure you only execute the rest of your to make sure you only execute the rest of your AfterDraw() when OpenGL is in GL_RENDER AfterDraw() when OpenGL is in GL_RENDER mode:mode:mode:mode:
{int rmode;GL.glGetIntegerv(GL.GL_RENDER_MODE, out rmode);if (rmode != GL.GL_RENDER)
return;}
Developer Summit 2007Developer Summit 2007 5555
Best Practices GuideBest Practices Guide
•• Locate() could be slow as it does a redraw in Locate() could be slow as it does a redraw in
Best Practices GuideBest Practices Guide
GL_SELECT mode, which means its speed varies GL_SELECT mode, which means its speed varies on how complex your dataset is. on how complex your dataset is. Gl b Di l G tS f P i t() l d ithGl b Di l G tS f P i t() l d ith•• GlobeDisplay::GetSurfacePoint() coupled with GlobeDisplay::GetSurfacePoint() coupled with GlobeDisplay:: GetSurfaceElevation() provides a GlobeDisplay:: GetSurfaceElevation() provides a good alternative.good alternative.gg
{void IGlobeDisplay.Locate(ISceneViewer pViewer, int xView, int yView, bool bGetTransformed, bool bGetEmptyGlobe, out ppPoint, out ppOwner);}
Developer Summit 2007Developer Summit 2007 5656
Best Practices GuideBest Practices Guide
•• Avoid calling methods on ArcObjects from Avoid calling methods on ArcObjects from
Best Practices GuideBest Practices Guide
different threads, unless you can guarantee that different threads, unless you can guarantee that the object was created on that thread. the object was created on that thread. U i ' ' i i diff t th d thU i ' ' i i diff t th d th•• Using '==' comparisons in a different thread than a Using '==' comparisons in a different thread than a creation thread with ArcObjects may not work as creation thread with ArcObjects may not work as expected. Some objects (like Layer objects) are expected. Some objects (like Layer objects) are p j ( y j )p j ( y j )cloned several times, so if there isn't an cloned several times, so if there isn't an appropriate Equals() override on that object, '==' appropriate Equals() override on that object, '=='
ffwill always return false because the underlying will always return false because the underlying pointer addresses are different (because of the pointer addresses are different (because of the clone)clone)
Developer Summit 2007Developer Summit 2007 5757
clone).clone).
Best Practices GuideBest Practices GuideBest Practices GuideBest Practices Guide•• When controlling the GlobeCamera object in local When controlling the GlobeCamera object in local
mode, offset the camera by a little (for examplemode, offset the camera by a little (for examplemode, offset the camera by a little (for example mode, offset the camera by a little (for example use about 0.01 radian), when looking straight use about 0.01 radian), when looking straight down. This will prevent the camera from running down. This will prevent the camera from running into uncontrollable spinninginto uncontrollable spinning
Developer Summit 2007Developer Summit 2007 5858
Best Practices GuideBest Practices Guide
•• When changing the enabled state of any OpenGL When changing the enabled state of any OpenGL
Best Practices GuideBest Practices Guide
attributes always use glPushAttrib with the attributes always use glPushAttrib with the GL_ENABLE_BIT to save and glPopAttrib to GL_ENABLE_BIT to save and glPopAttrib to restore the previous state If you don’t leaverestore the previous state If you don’t leaverestore the previous state. If you don t leave restore the previous state. If you don t leave OpenGL in the correct state it can adversely affect OpenGL in the correct state it can adversely affect the next draw cycle. the next draw cycle.
••Drawing the target position can be a useful visual Drawing the target position can be a useful visual cue, particularly when navigating underground. cue, particularly when navigating underground. Make sure to use a local origin when doing so, Make sure to use a local origin when doing so, otherwise it’s likely to jump around quite a lot as otherwise it’s likely to jump around quite a lot as you moveyou move
Developer Summit 2007Developer Summit 2007 5959
you move. you move.
Best Practices GuideBest Practices GuideBest Practices GuideBest Practices Guide•• Use custom Layers to extend the supported data Use custom Layers to extend the supported data
typestypes
•• Some of the advantages a CustomGlobeLayer Some of the advantages a CustomGlobeLayer gives you are the control over properties such asgives you are the control over properties such as
typestypes
gives you are the control over properties such as gives you are the control over properties such as DrawType, DrawMode and cache usage. DrawType, DrawMode and cache usage.
•• The custom layers in globe can be classified The custom layers in globe can be classified according to the DrawType they implement whichaccording to the DrawType they implement whichaccording to the DrawType they implement, which according to the DrawType they implement, which defines the layers drawing mechanism. defines the layers drawing mechanism.
•• Use custom Layers for dynamically changing data.Use custom Layers for dynamically changing data.
Developer Summit 2007Developer Summit 2007 6060
Best Practices GuideBest Practices GuideUnderstand the relationship between Observer, Understand the relationship between Observer,
Target and SurfaceTarget and Surface
Best Practices GuideBest Practices Guide
Target and SurfaceTarget and Surface
In In globalglobal mode the mode the target is located at the target is located at the center of the globe atcenter of the globe atcenter of the globe at center of the globe at all times. In all times. In surfacesurfacemode the target is mode the target is typically positioned on typically positioned on the globe surface.the globe surface.
Developer Summit 2007Developer Summit 2007 6161
AppendicesAppendices
Graphics card settingsGraphics card settings
AppendicesAppendices
Graphics card settingsGraphics card settings
•• Enable Enable Anisotropic FilteringAnisotropic Filtering for better texturing quality, for better texturing quality, p gp g g q y,g q y,avoiding ‘snowy’ artifacts in perspective view. Set it to the avoiding ‘snowy’ artifacts in perspective view. Set it to the maximum supported by the cardmaximum supported by the card
Li itLi it A tiA ti Ali iAli i ( 2 di bl it) Alth h It d( 2 di bl it) Alth h It d•• Limit Limit AntiAnti--AliasingAliasing (use 2x or disable it). Although It reduces (use 2x or disable it). Although It reduces line and edge line and edge artifacts, it can reduce rendering performance artifacts, it can reduce rendering performance
•• Turn off Turn off Vertical SyncVertical Sync option for better performanceoption for better performanceyy p pp p
Developer Summit 2007Developer Summit 2007 6262
AppendicesAppendicesAppendicesAppendices
Advanced registry settingsAdvanced registry settings
•• “Maximum internal viewport width” and “Maximum internal “Maximum internal viewport width” and “Maximum internal viewport height”viewport height”viewport heightviewport height
ArcGlobe memory and computation demands increase with the size ArcGlobe memory and computation demands increase with the size of the rendering window. This can make full screen views sluggish of the rendering window. This can make full screen views sluggish in highin high definition displays For this reason there is an internal limitdefinition displays For this reason there is an internal limitin highin high--definition displays. For this reason, there is an internal limit definition displays. For this reason, there is an internal limit in to the application window (viewport) size used to calculate the in to the application window (viewport) size used to calculate the rendering detail.rendering detail.
To make this limit more restrictive or more relaxed, edit the values To make this limit more restrictive or more relaxed, edit the values in the registry. in the registry.
Developer Summit 2007Developer Summit 2007 6363
AppendicesAppendices
•• Data Caching TipsData Caching Tips
•• Cache data when smooth interaction / Cache data when smooth interaction / presentation is importantpresentation is importantpresentation is important presentation is important
•• When a visibility distance is set, only the visible When a visibility distance is set, only the visible levels need to be cachedlevels need to be cached
•• Save a layer file or document if you want to Save a layer file or document if you want to preserve the cache. If the layer is invalidated preserve the cache. If the layer is invalidated afterwards, it must be saved againafterwards, it must be saved again
•• Layer files are the best way to reuse and share Layer files are the best way to reuse and share h f lh f l
Developer Summit 2007Developer Summit 2007 6464
caches safelycaches safely
AppendicesAppendices
•• Cache Location TipCache Location Tip : If you need to move or share : If you need to move or share caches set a portable location:caches set a portable location:caches, set a portable location:caches, set a portable location:
–– UNC pathsUNC paths (e.g. (e.g. \\\\myServermyServer\\ArcGlobeCacheArcGlobeCache) are ) are accessible from multiple machinesaccessible from multiple machinespp
–– Drive lettersDrive letters ((k:k:\\ArcGlobeCacheArcGlobeCache) allow moving caches ) allow moving caches easily by remapping the driveeasily by remapping the drive
Developer Summit 2007Developer Summit 2007 6565
AppendicesAppendices
ArcGlobe/GlobeControl Dev SamplesArcGlobe/GlobeControl Dev Samples
AppendicesAppendices
cG obe/G obeCo t o e Sa p escG obe/G obeCo t o e Sa p eshttp://edn.esri.comhttp://edn.esri.com
•• ArcGlobe VisualizationArcGlobe Visualization
–– Samples : 3D Analyst : Visualization : ArcGlobeSamples : 3D Analyst : Visualization : ArcGlobe
•• GlobeControl: Getting StartedGlobeControl: Getting Started•• GlobeControl: Getting StartedGlobeControl: Getting Started–– Samples : Controls : Getting Started with the Globe Samples : Controls : Getting Started with the Globe
ControlControl
•• GlobeControl: Animation, Navigation, EffectsGlobeControl: Animation, Navigation, Effects–– Samples : Controls : Globe ControlSamples : Controls : Globe Control
Developer Summit 2007Developer Summit 2007 6666
Samples : Controls : Globe ControlSamples : Controls : Globe Control
AppendicesAppendices
OpenGL ResourcesOpenGL Resources
AppendicesAppendices
•• The OpenGL HomepageThe OpenGL Homepage–– http://www.opengl.orghttp://www.opengl.org
•• Microsoft OpenGL ReferenceMicrosoft OpenGL Reference–– http://msdn.microsoft.com/library/enhttp://msdn.microsoft.com/library/en--us/dnanchor/html/opengl.aspus/dnanchor/html/opengl.asp
•• NeHe (OpenGL Tutorial)NeHe (OpenGL Tutorial)•• NeHe (OpenGL Tutorial)NeHe (OpenGL Tutorial)–– http://nehe.gamedev.net/http://nehe.gamedev.net/
•• Colin Fahey’s C# OpenGL WrapperColin Fahey’s C# OpenGL Wrapper–– http://www.colinfahey.com/opengl/csharp.htmhttp://www.colinfahey.com/opengl/csharp.htm
•• OpenGL for Visual BasicOpenGL for Visual Basic
Developer Summit 2007Developer Summit 2007 6767
–– http://is6.pacific.net.hk/~edx/http://is6.pacific.net.hk/~edx/