How to display symbol frol ServerStyle

Discussion created by fabpuddu on Mar 14, 2012
Latest reply on Mar 15, 2012 by fabpuddu

I try to display the symbol, example 3D Billboards.ServerStyle, on arcglobe control. I get ISymbol from gallery and add a GraphicsLayer, but the symbol is not display fine, it's under the data surface.

this is my code:

Dim globeGraphicsLayer As ESRI.ArcGIS.Carto.IGraphicsContainer = New ESRI.ArcGIS.GlobeCore.GlobeGraphicsLayerClass
Dim layer As ESRI.ArcGIS.Carto.ILayer = CType(globeGraphicsLayer, ESRI.ArcGIS.Carto.ILayer) 'Explicit Cast
layer.Name = "PIPPO"
Dim scene As ESRI.ArcGIS.Analyst3D.IScene = CType(Me.m_objGlobeControl.Globe, ESRI.ArcGIS.Analyst3D.IScene) ' Explicit Cast
scene.AddLayer(layer, True)

Dim styleGallery As IStyleGallery = New ServerStyleGalleryClass()
Dim styleStorage As IStyleGalleryStorage = TryCast(styleGallery, IStyleGalleryStorage)
styleStorage.TargetFile = "C:\Programmi\ArcGIS\Engine10.0\Styles\3D Billboards.ServerStyle"
styleStorage.AddFile("C:\Programmi\ArcGIS\Engine10.0\Styles\3D Billboards.ServerStyle")
Dim enumStyleGalleryItem As IEnumStyleGalleryItem = styleGallery.Items("Marker Symbols", "C:\Programmi\ArcGIS\Engine10.0\Styles\3D Billboards.ServerStyle", "")
Dim styleItem As IStyleGalleryItem = enumStyleGalleryItem.Next()
While (styleItem IsNot Nothing)
    If styleItem.Name = "Red Pushpin 3" Then
         Exit While
    End If
    styleItem = enumStyleGalleryItem.Next()
End While
Dim pSymbol As ISymbol = New SimpleMarkerSymbolClass()
pSymbol = TryCast(styleItem.Item, ISymbol)

Dim pColor As IColor = New RgbColor
pColor.RGB = RGB(0, 255, 0)
pColor.Transparency = 255

Dim point As ESRI.ArcGIS.Geometry.IPoint = New ESRI.ArcGIS.Geometry.PointClass
point.PutCoords(35.4802, 33.9008)

Dim pMarkerElement As IMarkerElement = New MarkerElementClass()
Dim markerSymbol As IMarkerSymbol = TryCast(pSymbol, IMarkerSymbol)
markerSymbol.Color = pColor
markerSymbol.Size = 200

Dim pElement As IElement = TryCast(pMarkerElement, IElement)
pElement.Geometry = point

pMarkerElement.Symbol = markerSymbol

Dim markerElement_2 As ESRI.ArcGIS.Carto.IMarkerElement = CType(pMarkerElement, ESRI.ArcGIS.Carto.IMarkerElement) ' Explicit Cast
markerElement_2.Symbol = markerSymbol
globeGraphicsLayer.AddElement(pMarkerElement, 1)