Select to view content in your preferred language

Silverlight SimpleMarkerSymbol.SimpleMarkerStyle.Triangle offset from other styles

1406
4
11-22-2011 05:24 AM
deleted-user-Ohz6rwd1kavx
Deactivated User
Hi All,

Working in Silverlight with SimpleMarkerSymbols, we noticed that Triangle style symbols have a different origin from other styles (e.g. Circle). We want to correct this problem in code, but how?

See attached image. The Circle marker (as well as other styles), center on the same point -- marked with the small black point. However, Triangle markers are located with an offset -- down and to the right.

We are seeing this behavior graphics in GraphicLayers and FeatureLayers.

Does anyone know how to workaround this?

[INDENT]Unfortunately, the XOffset and YOffset properties are NOT settable.

See note "Setting the OffsetX property is not allowed on the SimpleMarkerSymbol sub class." here:

http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/apiref/topic835.html[/INDENT]

I have tried directly setting these properties directly, but I get a "not supported" exception.
markerSymbol.OffsetX = 0;
markerSymbol.OffsetY = 0;


I have also tried this, but I get System.ArgumentException was unhandled by user code
Message='0' is not a valid value for property 'OffsetX'.
markerSymbol.SetValue(MarkerSymbol.OffsetXProperty, 0);
markerSymbol.SetValue(MarkerSymbol.OffsetYProperty, 0);


I have combed the doc/forums and not figured this out. I wonder if I can use .ControlTemplate to solve this, but I am not sure how.

Best idea would be to find a way to set x/y offset, trap for the Triangle style, and set values for these based on symbol size to "shift" marker back from whence it came.

Any ideas/solutions out there to this one? I am using ESRI.ArcGIS.Client.dll Version 2.2.0.629.

Thanks,

-Cory
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
OffsetX, OffsetY can be set on a MarkerSymbol (like in this example: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#CustomSymbols). There are more custom symbols here: http://help.arcgis.com/en/webapi/silverlight/samples/SymbolGalleryWeb/start.htm
0 Kudos
deleted-user-Ohz6rwd1kavx
Deactivated User
Hi Jennifer,

Thanks for your reply, but this doesn't answer my questions:

1) How can I set the XOffset/YOffset of a SimpleMarkerSymbol?

2) Is the behavior of the Triangle SimpleMarkerSymbol  (described in my original post) a bug in your system? How can I work around it?

Finally, we have it on our "todo" list to look at how we're using symbols in our SL app (markers specifically). The custom symbols and symbol gallery definitely show me that this is where we want to go (interactivity, snazzy look and feel)... BUT, I am fairly certain that the reason why we went with SimpleMarkerSymbols was to support our own printing/pdf generation solution... (aside: we are using a print solution from a 3rd party, which depends at some level on Web ADF I believe).

3) ...so, my last question is: We are using ArcGIS Server 10.0 and SL 2.2. If we use symbols as provided in the symbol gallery/custom symbols sample, what are our choices for producing pdf and high resolution image output that includes these symbols? Is there a recommended ESRI solution, and what is it? With the recommended solution, does ESRI api provide translators to automatically handle these types of symbols, or does one need to code one's own translators?

Thanks,

-Cory
0 Kudos
JenniferNery
Esri Regular Contributor
Sorry I meant to say that changing offsets in SimpleMarkerSymbol is not supported which why I suggested looking into MarkerSymbol instead.

The symbol template used for SimpleMarkerSymbol has not changed, we do not apply offset or transforms that can cause the symbol to not center correctly. It has always been:
 <ControlTemplate x:Key="SimpleMarkerSymbol_Triangle">
  <TextBlock Text="�?�" RenderTransformOrigin="0.5,0.5" FontFamily="Arial" FontSize="{Binding Path=Symbol.Size, Converter={StaticResource multiplicationConverter}, ConverterParameter=1.5, Mode=OneWay}" Foreground="{Binding Symbol.Color}" />
 </ControlTemplate>


You are correct that only symbols supported by REST can be serialized for printing. With the exception of TextSymbol, these are the symbols supported for printing: http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/symbol.html
0 Kudos
deleted-user-Ohz6rwd1kavx
Deactivated User
Hi Jennifer,

We have abandoned SimpleMarkerSymbols for us on client-side FeatureLayers.

Two reasons:
1) the triangle shaped SimpleMarkerSymbol is definitely shifted "down and to the right" on the map,  compared to the other shapes.

2) SimpleMarkerSymbol does not support an outline which we need.

Our solution was to write an OutlineMarkerSymbol that inherits from MarkerSymbol. We used the nice xaml examples you all provide in your symbol gallery (very nice, thanks!).

Fortunately we are able to translate this custom symbol to a symbol which our printing/export solution understands (basically a simple marker symbol with outline support).

As I said above, our choice of marker is currently constrained by what we can print/export. We have a longer-term goal of "opening this up", so we can use snazzier symbols.

Thanks,

-Cory
0 Kudos