Select to view content in your preferred language

layers

1151
5
06-24-2010 06:22 AM
ThaoNguyen
Emerging Contributor
Hi experts,
I have 2 layers in my map as follow:
<esri:Map x:Name="TestMap" Extent="-130,10,-70,60" Width="700" Height="500"
                  MouseRightButtonDown="TestMap_MouseRightButtonDown"                  
                  Grid.Row="0" Grid.RowSpan="2" Grid.Column="0"
                  VerticalAlignment="Top"> 
       <esri:Map.Layers>
                <esri:ArcGISDynamicMapServiceLayer ID="BigMap"
                    Url="http://xxx/ArcGIS/rest/services/MyMap/MapServer" />
                   
                <!-- graphic map  -->
                <esri:GraphicsLayer ID="ResultMap"
                                    MouseLeftButtonDown="annotations_MouseLeftButtonDown"
                                    MouseEnter="GraphicsLayer_MouseEnter"
                                    MouseLeave="GraphicsLayer_MouseLeave">
                </esri:GraphicsLayer>
       </esri:Map.Layers>
</esri:Map>

Question 1:
Whenever I select an area (e.g a region or group of states), the graphic layer will paint that area with a color (it is like the spatial query sample provided by ArcGIS).  Since the graphic layer is on top of the "BigMap" layer, the BigMap layer looks vague under the selected area (you can see that in the sample version as well).  Is there a way I can make both layers look clear? 

Question 2:
If I change to Pan mode, I cannot drag the map when the cursor is on top of the painted area.  In my code, when a tool bar icon is clicked, I also enable/disable a Draw instance.  Don't know if this is the cause of the problem.  The spatial query doesn't have this problem and it doesn't enable/disable Draw instance.


Thanks so much!
0 Kudos
5 Replies
DominiqueBroux
Esri Frequent Contributor
Question 1 : You can change the transparency of the graphics in order to change the way the basemap is visible. But more you will see the graphics, less you will see the basemap.
Note that in the sample the transparency is specified with an color alpha value (88) given by the two first hexdecimal digits.

Question2 : The sample has this behavior as well. If you activate a tool, you are no more able to pan. So looks normal.
0 Kudos
ThaoNguyen
Emerging Contributor
Thanks Dominique!!
Question1:
Your answer means that I cannot make both look clear, right?   Before posting the question, I tried to set opacity value of GraphicsLayer.  If opacity of GraphicsLayer is low, the basemap is clear but the colors on GraphicsLayer is hard to see 😞 and vice versa.  Is there a way to merge the 2 layers or whatever that can paint the basemap without changing the basemap opacity?

Question2:
hmm, in the spatial query sample, I can move the map while the cursor is on top of the painting area.
http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/samples/start.htm#SpatialQuery
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Question1:

Your answer means that I cannot make both look clear, right?

From my understanding : yes.
You can only adjust the opacity (or color transparency for same result) to get the best result for your case.

Is there a way to merge the 2 layers or whatever that can paint the basemap without changing the basemap opacity?

To merge 2 layers you would have to decide the opacity of each layer as well ==> same result

Question2:

hmm, in the spatial query sample, I can move the map while the cursor is on top of the painting area.
http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/samples/start.htm#SpatialQuery

You are right when no tool are active. But if you activate one of the tool, you can no more pan because the mouse event is handled by the tool.
0 Kudos
ThaoNguyen
Emerging Contributor
Question1:

From my understanding : yes.
You can only adjust the opacity (or color transparency for same result) to get the best result for your case.


To merge 2 layers you would have to decide the opacity of each layer as well ==> same result

Question2:

You are right when no tool are active. But if you activate one of the tool, you can no more pan because the mouse event is handled by the tool.



Actually, when the map is first launched, there is no tool activated, I still cannot drag the map when the cursor is on the graphics layer.  Draw.IsEnabled = false, draw mode is None.  What else do you think may cause the problem?  When my Pan icon is clicked, I disable the draw and change draw mode to none as well.  I guess something else causes the problem, but can't figure out what.
0 Kudos
ThaoNguyen
Emerging Contributor
Actually, when the map is first launched, there is no tool activated, I still cannot drag the map when the cursor is on the graphics layer.  Draw.IsEnabled = false, draw mode is None.  What else do you think may cause the problem?  When my Pan icon is clicked, I disable the draw and change draw mode to none as well.  I guess something else causes the problem, but can't figure out what.


I found out why I could not drag.  In the event handler method for MouseLeave, I had the line
QueryDetailsDataGrid.Focus(); which focus the data grid.  After I removed this line, the drag problem was resolved.  Don't know why.
0 Kudos