ArcGIS API for Silverlight 載入google地圖
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace Syit.CommonClass
{
public static class ColorRevert
{
#region 顏色轉換
public static Color ToColor(this string colorName)
{
if (colorName.StartsWith("#"))
colorName = colorName.Replace("#", string.Empty);
int v = int.Parse(colorName, System.Globalization.NumberStyles.HexNumber);
return new Color()
{
A = Convert.ToByte((v >> 24) & 255),
R = Convert.ToByte((v >> 16) & 255),
G = Convert.ToByte((v >> 8) & 255),
B = Convert.ToByte((v >> 0) & 255)
};
}
public static int ToArgb(this Color color)
{
int argb = color.A << 24;
argb += color.R << 16;
argb += color.G << 8;
argb += color.B;
return argb;
}
#endregion
}
}
private void btography_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
e.Handled = true;
}
private void btography_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//設定背景顏色
this.rect1.Stroke = new SolidColorBrush(ColorRevert.ToColor("#FFF29536"));
this.rect2.Stroke = new SolidColorBrush(ColorRevert.ToColor("#FF7392BD"));
this.rect3.Stroke = new SolidColorBrush(ColorRevert.ToColor("#FF7392BD"));
setSelectedLinearGradientBrush(rect1);
setUnSelectedLinearGradientBrush(rect2);
setUnSelectedLinearGradientBrush(rect3);
//設定地圖顯示與隱藏
topographyLayer.Visible = true; //google地形圖
roadLayer.Visible = false; //google交通圖
sateliateLayer.Visible = false; //google衛星圖
sateliateTextLayer.Visible = false; //google衛星圖文字
}
private void broad_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
e.Handled = true;
}
private void broad_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//設定背景顏色
this.rect1.Stroke = new SolidColorBrush(ColorRevert.ToColor("#FF7392BD"));
this.rect2.Stroke = new SolidColorBrush(ColorRevert.ToColor("#FFF29536"));
this.rect3.Stroke = new SolidColorBrush(ColorRevert.ToColor("#FF7392BD"));
setUnSelectedLinearGradientBrush(rect1);
setSelectedLinearGradientBrush(rect2);
setUnSelectedLinearGradientBrush(rect3);
//設定地圖顯示與隱藏
topographyLayer.Visible = false; //google地形圖
roadLayer.Visible = true; //google交通圖
sateliateLayer.Visible = false; //google衛星圖
sateliateTextLayer.Visible = false; //google衛星圖文字
}
private void bsateliate_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
e.Handled = true;
}
private void bsateliate_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//設定背景顏色
this.rect1.Stroke = new SolidColorBrush(ColorRevert.ToColor("#FF7392BD"));
this.rect2.Stroke = new SolidColorBrush(ColorRevert.ToColor("#FF7392BD"));
this.rect3.Stroke = new SolidColorBrush(ColorRevert.ToColor("#FFF29536"));
setUnSelectedLinearGradientBrush(rect1);
setUnSelectedLinearGradientBrush(rect2);
setSelectedLinearGradientBrush(rect3);
//設定地圖顯示與隱藏
topographyLayer.Visible = false; //google地形圖
roadLayer.Visible = false; //google交通圖
sateliateLayer.Visible = true; //google衛星圖
sateliateTextLayer.Visible = true; //google衛星圖文字
}
//選中狀態
public void setSelectedLinearGradientBrush(Rectangle rect)
{
//設定stroke值
rect.Stroke = new SolidColorBrush(ColorRevert.ToColor("#FFF29536"));
//設定漸變色
GradientStop gs = new GradientStop();
gs.Offset = 0.0;
gs.Color = ColorRevert.ToColor("#FFFDF6DF");
GradientStop gs1 = new GradientStop();
gs1.Offset = 1.0;
gs1.Color = Colors.White;
GradientStop gs2 = new GradientStop();
gs2.Offset = 0.5;
gs2.Color = ColorRevert.ToColor("#FFF9E8B2");
GradientStop gs3 = new GradientStop();
gs3.Offset = 0.5;
gs3.Color = ColorRevert.ToColor("#FFFFD75D");
LinearGradientBrush lgb = new LinearGradientBrush();
lgb.StartPoint = new Point(0.5, 0);
lgb.EndPoint = new Point(0.5, 1);
lgb.GradientStops.Add(gs);
lgb.GradientStops.Add(gs1);
lgb.GradientStops.Add(gs2);
lgb.GradientStops.Add(gs3);
rect.Fill = lgb;
}
//未選中狀態
public void setUnSelectedLinearGradientBrush(Rectangle rect)
{
//設定stroke值
rect.Stroke = new SolidColorBrush(ColorRevert.ToColor("#FF7392BD"));
//設定漸變色
GradientStop gs = new GradientStop();
gs.Offset = 0.0;
gs.Color = ColorRevert.ToColor("#FFF5F6FB");
GradientStop gs1 = new GradientStop();
gs1.Offset = 1.0;
gs1.Color = ColorRevert.ToColor("#FFE6EDFC");
GradientStop gs2 = new GradientStop();
gs2.Offset = 0.5;
gs2.Color = ColorRevert.ToColor("#FFE6EBF5");
GradientStop gs3 = new GradientStop();
gs3.Offset = 0.5;
gs3.Color = ColorRevert.ToColor("#FFD7E3F7");
LinearGradientBrush lgb = new LinearGradientBrush();
lgb.StartPoint = new Point(0.5, 0);
lgb.EndPoint = new Point(0.5, 1);
lgb.GradientStops.Add(gs);
lgb.GradientStops.Add(gs1);
lgb.GradientStops.Add(gs2);
lgb.GradientStops.Add(gs3);
rect.Fill = lgb;
}
<Border HorizontalAlignment="Left" Margin="50,5,0,0" Width="230" BorderThickness="1" CornerRadius="5" VerticalAlignment="Top">
<Border.Effect>
<DropShadowEffect Direction="-90" Color="#FF4D4D4D" ShadowDepth="4"/>
</Border.Effect>
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFDDF1FD" Offset="0"/>
<GradientStop Color="#FFCAE9FC" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<Grid HorizontalAlignment="Left" Width="229">
<Border x:Name="btography" HorizontalAlignment="Left" Margin="16,4,0,4" Width="64" MouseLeftButtonDown="btography_MouseLeftButtonDown" MouseLeftButtonUp="btography_MouseLeftButtonUp">
<Grid>
<Rectangle Stroke="#FFF29536" RadiusX="1" RadiusY="1" x:Name ="rect1">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFDF6DF" Offset="0"/>
<GradientStop Color="White" Offset="1"/>
<GradientStop Color="#FFF9E8B2" Offset="0.5"/>
<GradientStop Color="#FFFFD75D" Offset="0.5"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<TextBlock Margin="16,6,13,2" TextWrapping="Wrap" Text="地形" Foreground="#FF0B333C" FontWeight="Bold" FontSize="14.667" FontFamily="SimSun"/>
</Grid>
</Border>
<Border x:Name="broad" Margin="84,4,81,4" MouseLeftButtonDown="broad_MouseLeftButtonDown" MouseLeftButtonUp="broad_MouseLeftButtonUp">
<Grid>
<Rectangle Stroke="#FF7392BD" RadiusX="1" RadiusY="1" x:Name ="rect2">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFF5F6FB" Offset="0"/>
<GradientStop Color="#FFE6EDFC" Offset="1"/>
<GradientStop Color="#FFE6EBF5" Offset="0.5"/>
<GradientStop Color="#FFD7E3F7" Offset="0.5"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<TextBlock Margin="17,6,11,2" TextWrapping="Wrap" Text="街道" Foreground="#FF0B333C" FontWeight="Bold" FontSize="14.667" FontFamily="SimSun"/>
</Grid>
</Border>
<Border x:Name="bsateliate" HorizontalAlignment="Right" Margin="0,4,14,4" Width="64" MouseLeftButtonDown="bsateliate_MouseLeftButtonDown" MouseLeftButtonUp="bsateliate_MouseLeftButtonUp">
<Grid>
<Rectangle Stroke="#FF7392BD" RadiusX="1" RadiusY="1" x:Name ="rect3">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFF5F6FB" Offset="0"/>
<GradientStop Color="#FFE6EDFC" Offset="1"/>
<GradientStop Color="#FFE6EBF5" Offset="0.5"/>
<GradientStop Color="#FFD7E3F7" Offset="0.5"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<TextBlock Margin="18,6,12,2" TextWrapping="Wrap" Text="影像" Foreground="#FF0B333C" FontWeight="Bold" FontSize="14.667" FontFamily="SimSun"/>
</Grid>
</Border>
</Grid>
</Border>
相關文章
- ArcGIS API for Silverlight載入google地圖(後續篇)APIGo地圖
- ArcGIS API for Silverlight中載入Google地形圖(瓦片圖)APIGo
- ArcGIS API for Silverlight載入BingMap遙感地圖API地圖
- ArcGIS API for Silverlight 地圖載入進度條類之MapProgressBarAPI地圖APP
- ArcGis api配合vue開發入門系列(一)引入arcgis api以及載入地圖APIVue地圖
- 解決ArcGIS API for Silverlight 載入地圖的內外網訪問問題API地圖
- ArcGIS API for Silverlight實現地圖測距功能API地圖
- ArcGIS API for Silverlight 呼叫GP服務載入等值線圖層API
- ArcGIS API for Silverlight地圖載入眾多點時,使用Clusterer解決重疊問題API地圖
- ArcGIS API for Silverlight 點選地圖彈出自定義窗體API地圖
- ArcGIS API for Silverlight開發入門準備API
- ArcGIS API for Silverlight 中根據座標點在地圖上打標記API地圖
- ArcGIS API for Silverlight 地圖中解決點眾多的簇解決方法API地圖
- ArcGIS API for Silverlight 滑鼠移入移出地圖要素彈出視窗(優化處理)API地圖優化
- ArcGIS API for Silverlight 地圖元素點閃爍,線流動顯示的處理方式API地圖
- ArcGIS API for Silverlight 點選地圖上的要素,彈出視窗(使用Telerik RadWindow)API地圖
- 基於ArcGIS API for Javascript的地圖編輯工具APIJavaScript地圖
- ArcGIS API for Silverlight 學習筆記API筆記
- ArcGIS API for Silverlight 實現修改地圖上的工程點位置API地圖
- ArcGIS API for Silverlight之ElementLayer使用注意點API
- ArcGIS API for Silverlight之配準JPG圖片地圖文字傾斜解決方案API地圖
- ArcGIS API for Silverlight 繪製降雨路徑動畫API動畫
- ArcGIS API for Silverlight程式碼中使用Template模板API
- 建立第一個ArcGIS API for Silverlight應用API
- ArcGIS載入高德、OSM和谷歌等地圖谷歌地圖
- ArcGIS API for Silverlight 動態圖層(ArcGISDynamicMapServiceLayer)的顯示與隱藏API
- ArcGIS API for Silverlight 查詢點閃爍顯示API
- ArcGIS API for Silverlight動態標繪的實現API
- ArcGIS API for Silverlight 當DataGrid選中項時,地圖聚焦彈出視窗,並可以播放音訊檔案API地圖音訊
- SuperMap iClient for Silverlight 載入天地圖client地圖
- ArcGIS API for Silverlight 呼叫GP服務繪製等值面API
- ArcGIS API for Silverlight 之ElementLayer使用及TextSymbol的模板使用APISymbol
- ArcGIS API for Silverlight開發中常用問題彙總API
- ArcGIS API for Silverlight 滑鼠移動顯示地理座標API
- 【Google官方教程】第一課:高效地載入大Bitmap(點陣圖)Go
- ArcGIS API for JavaScript根據兩個點座標在地圖上畫線APIJavaScript地圖
- 百度地圖API入門——(5)百度地圖API的簡介地圖API
- ArcGIS API for Silverlight 查詢點聚焦的一個注意點API